99 lines
3.2 KiB
PHP
99 lines
3.2 KiB
PHP
|
|
<?php
|
||
|
|
|
||
|
|
set_time_limit(0);
|
||
|
|
|
||
|
|
require_once($_SERVER['DOCUMENT_ROOT']."/config.php");
|
||
|
|
require_once($_SERVER['DOCUMENT_ROOT']."/engine/functions.php");
|
||
|
|
|
||
|
|
//ini_set('display_errors', 1);
|
||
|
|
//error_reporting(E_ALL & ~E_DEPRECATED & ~E_STRICT & ~E_NOTICE);
|
||
|
|
|
||
|
|
$sql="SELECT * FROM users WHERE (id_tarif = 5 or id_tarif = 7) and blocked != 1";
|
||
|
|
|
||
|
|
$rez = mysql_query($sql);
|
||
|
|
$f1=file("https://joywork.ru/template_mail/endoftest.html");
|
||
|
|
$text = implode("",$f1);
|
||
|
|
while($user = mysql_fetch_assoc($rez)) {
|
||
|
|
|
||
|
|
$id_tarif = $user['id_tarif'];
|
||
|
|
$date_tarif = $user['date_tarif'];
|
||
|
|
|
||
|
|
$tarif = new Tarif;
|
||
|
|
|
||
|
|
$tarif->get($id_tarif);
|
||
|
|
|
||
|
|
$date_tarif = strtotime($date_tarif);
|
||
|
|
|
||
|
|
$date_end = $date_tarif + $tarif->period * 3600 * 24;
|
||
|
|
|
||
|
|
$dney = ceil(($date_end - time()) / 24 / 3600);
|
||
|
|
|
||
|
|
if ($dney == 4) {
|
||
|
|
|
||
|
|
$text4 = str_replace("<%num_day%>", "4 дня", $text);
|
||
|
|
$text4 = str_replace("<%fio%>", trim($user['last_name'] . ' ' . $user['first_name'] . ' ' . $user['middle_name']), $text4);
|
||
|
|
|
||
|
|
mailClientFromJoywork($user['email'],"Окончание тестового периода на сайте ".$_SERVER['SERVER_NAME'], $text4);
|
||
|
|
}
|
||
|
|
|
||
|
|
if ($dney == 2) {
|
||
|
|
|
||
|
|
$text2 = str_replace("<%num_day%>", "2 дня", $text);
|
||
|
|
$text2 = str_replace("<%fio%>", trim($user['last_name'] . ' ' . $user['first_name'] . ' ' . $user['middle_name']), $text2);
|
||
|
|
|
||
|
|
mailClientFromJoywork($user['email'],"Окончание тестового периода на сайте ".$_SERVER['SERVER_NAME'], $text2);
|
||
|
|
}
|
||
|
|
if ($dney == 1) {
|
||
|
|
|
||
|
|
$text1 = str_replace("<%num_day%>", "1 день", $text);
|
||
|
|
$text1 = str_replace("<%fio%>", trim($user['last_name'] . ' ' . $user['first_name'] . ' ' . $user['middle_name']), $text1);
|
||
|
|
|
||
|
|
mailClientFromJoywork($user['email'],"Окончание тестового периода на сайте ".$_SERVER['SERVER_NAME'], $text1);
|
||
|
|
}
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
$sql="SELECT * FROM users WHERE id_tarif > 0 and blocked != 1";
|
||
|
|
|
||
|
|
$rez = mysql_query($sql);
|
||
|
|
$f1=file("https://joywork.ru/template_mail/rememberofpay.html");
|
||
|
|
$text = implode("",$f1);
|
||
|
|
|
||
|
|
while($user = mysql_fetch_assoc($rez)) {
|
||
|
|
|
||
|
|
$id_tarif = $user['id_tarif'];
|
||
|
|
$date_tarif = $user['date_tarif'];
|
||
|
|
|
||
|
|
$tarif = new Tarif;
|
||
|
|
|
||
|
|
$tarif->get($id_tarif);
|
||
|
|
|
||
|
|
$date_tarif = strtotime($date_tarif);
|
||
|
|
|
||
|
|
$date_end = $date_tarif + $tarif->period * 3600 * 24;
|
||
|
|
|
||
|
|
$dney = ceil(($date_end - time()) / 24 / 3600);
|
||
|
|
|
||
|
|
if ($dney == 0) {
|
||
|
|
|
||
|
|
$text2 = str_replace("<%fio%>", trim($user['last_name'] . ' ' . $user['first_name'] . ' ' . $user['middle_name']), $text);
|
||
|
|
|
||
|
|
mailClientFromJoywork($user['email'],"Необходимо оплатить тариф на сайте ".$_SERVER['SERVER_NAME'], $text2);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
$sql="SELECT * FROM users WHERE blocked != 1";
|
||
|
|
|
||
|
|
$rez = mysql_query($sql);
|
||
|
|
$f1=file("https://joywork.ru/template_mail/remembermail.html");
|
||
|
|
$text = implode("",$f1);
|
||
|
|
while($user = mysql_fetch_assoc($rez)) {
|
||
|
|
$dney = ceil((time() - strtotime($user['last_auth'])) / 24 / 3600);
|
||
|
|
|
||
|
|
if ($dney == 10) {
|
||
|
|
|
||
|
|
$text2 = str_replace("<%fio%>", trim($user['last_name'] . ' ' . $user['first_name'] . ' ' . $user['middle_name']), $text);
|
||
|
|
|
||
|
|
mailClientFromJoywork($user['email'],"Вы давно не заходили на сайт ".$_SERVER['SERVER_NAME'], $text2);
|
||
|
|
}
|
||
|
|
}
|