0) foreach($data_send as $mailto) { $day_check = $birth_check = $other_check = 0;//resetujemy zmienne $day_check_ = $birth_check_ = $other_check_ = 0;//resetujemy zmienne $query = EproCore::getDB()->_mysql_query("SELECT email FROM $t_client WHERE id = $mailto[client_id]"); $user_data = EproCore::getDB()->_mysql_fetch_assoc($query);//pobieramy dane osoby do wysylki $name_ = explode("-",$mailto[name_day]); $name = date("Y")."-".$name_[1]."-".$name_[0]; //jezeli daty są zerowe to nie if($mailto[name_day]!="00-00") $day_check = intval((strtotime(date("Y-m-d", strtotime($name))) - strtotime(date("Y-m-d")))/86400); $birth_ = explode("-",$mailto[name_day]); $birth = date("Y")."-".$birth_[1]."-".$birth_[0]; if($mailto[birth_day]!="00-00") $birth_check = intval((strtotime(date("Y-m-d", strtotime($birth))) - strtotime(date("Y-m-d")))/86400); $other_ = explode("-",$mailto[name_day]); $other = date("Y")."-".$other_[1]."-".$other_[0]; if($mailto[other_day]!="00-00") $other_check = intval((strtotime(date("Y-m-d", strtotime($other))) - strtotime(date("Y-m-d")))/86400); echo $day_check; if($day_check==14 || $birth_check==14 || $other_check==14) { if($day_check==14) { $day_check_ = $mailto[name_day_check]+1; } if($birth_check==14) { $birth_check_ = $mailto[birth_day_check]+1; } if($other_check==14) { $other_check_ = $mailto[other_day_check]+1; } EproCore::getDB()->_mysql_query("UPDATE $t_address_book SET name_day_check = $day_check_, birth_day_check = $birth_check_, other_day_check = $other_check_ WHERE id = $mailto[id]"); /* ob_start(); ?>
$_var_shop_email, "shop_name" =>$_var_shop_name, ); $email_subject=nl2br(change_txt($_lang_addrees_book_text,$_array_data_company_address)); $temat_maila=$_lang_addrees_book_title; $email_zwrotny=$_var_shop_email; $headers = "Content-type: text/html; charset=UTF-8\r \n"; $headers .= "Content-transfer-encoding: 8BIT\r \n"; $headers .= "From: <".$email_zwrotny.">\r \n"; $headers .= "Reply-To: <".$email_zwrotny.">\r \n"; $headers .= "Return-Path: ".$email_zwrotny."\r \n"; $headers .= "MIME-version: 1.0\r \n"; //if($user_data[email]=="m.pietrasz@epro.com.pl") { $wyslane_maila[] = $user_data[email]; if(!in_array($user_data[email],$wyslane_maila)) mail($user_data[email], convert_string($_lang_addrees_book_title,$_var_email_convert_string), $email_subject, $_conf_header_mail[html]); } } } //zapytanko $data = mktime (0,0,0,date("m") ,date("d")+1,date("Y")); $new_data = date("d-m",$data); //zapytanko $query="SELECT * FROM $t_address_book WHERE (name_day = '$new_data' && name_day_check = 2) || (birth_day = '$new_data' && birth_day_check = 2) || (other_day = '$new_data' && other_day_check = 2)"; $data_send = Table2Array($query);//pobieramy rekordy pasujace do wynikow czyli takie gdzie data jest <= dzisiejsze + 14 dni if(sizeof($data_send)>0) foreach($data_send as $mailto) { $day_check = $birth_check = $other_check = 0;//resetujemy zmienne $day_check_ = $birth_check_ = $other_check_ = 0;//resetujemy zmienne $new_data_day = $new_data_birth = $new_data_other = 0;//resetujemy zmienne //jezeli daty są zerowe to nie $name_ = explode("-",$mailto[name_day]); $name = date("Y")."-".$name_[1]."-".$name_[0]; //jezeli daty są zerowe to nie if($mailto[name_day]!="00-00") $day_check = intval((strtotime(date("Y-m-d", strtotime($name))) - strtotime(date("Y-m-d")))/86400); $birth_ = explode("-",$mailto[name_day]); $birth = date("Y")."-".$birth_[1]."-".$birth_[0]; if($mailto[birth_day]!="00-00") $birth_check = intval((strtotime(date("Y-m-d", strtotime($birth))) - strtotime(date("Y-m-d")))/86400); $other_ = explode("-",$mailto[name_day]); $other = date("Y")."-".$other_[1]."-".$other_[0]; if($mailto[other_day]!="00-00") $other_check = intval((strtotime(date("Y-m-d", strtotime($other))) - strtotime(date("Y-m-d")))/86400); if($day_check==1 || $birth_check==1 || $other_check==1) { //echo "wysylam do ".$user_data[email]."
"; if($day_check==1) { $day_check_ = $mailto[name_day_check]-1; } if($birth_check==1) { $birth_check_ = $mailto[birth_day_check]-1; } if($other_check==1) { $other_check_ = $mailto[other_day_check]-1; } EproCore::getDB()->_mysql_query("UPDATE $t_address_book SET name_day_check = $day_check_, birth_day_check = $birth_check_, other_day_check = $other_check_ WHERE id = $mailto[id]"); } } ?>