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); echo $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); echo $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); echo $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); echo $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); echo $text2; } }