function genString($number) { for ($i = 0; $i < $number; $i++) { $hash = $hash . randomChar(); } return $hash; }
sendElasticEmail("*****@*****.**", $sujet, "", stripslashes($corpsCode), $mailCustomer, $mailNameCustomer); sendElasticEmail("*****@*****.**", $sujet, "", stripslashes($corpsCode), $mailCustomer, $mailNameCustomer); sendElasticEmail("*****@*****.**", $sujet, "", stripslashes($corpsCode), $mailCustomer, $mailNameCustomer); /////////////////////////////////////////////////////////// } elseif (!empty($_GET['postaction']) && $_GET['postaction'] == 'envoi') { // ENVOI EN MASSE ENVOI EN MASSEENVOI EN MASSEENVOI EN MASSEENVOI EN MASSEENVOI EN MASSE $id_journal = $newsletter->journalNewsletterAdd($_GET['id']); $contact = new Contact(); $result = $contact->contactGetForNewsletter(); //print_r($result); if (!empty($result)) { foreach ($result as $value) { $_to = $value['email']; $regex = '#^[\\w.-]+@[\\w.-]+\\.[a-zA-Z]{2,6}$#'; if (preg_match($regex, $_to)) { $codeRandom = randomChar(); $corpsCode = str_replace('XwXwXwXw', $codeRandom, $corps); $newsletter->journalNewsletterDetailAdd($id_journal, $_to, $codeRandom, null); ////////////////!!!!!!!!!!!!!!!!!!!!!!!!!!!!//////////// //mail($_to, $sujet, stripslashes($corpsCode), $entete); /////////////////////////////////////////////////////////// ////////////////ELASTIC MAIL ICONEO!!!!!!!!!!//////////// sendElasticEmail($_to, $sujet, "", stripslashes($corpsCode), $mailCustomer, $mailNameCustomer); /////////////////////////////////////////////////////////// error_log(date("Y-m-d H:i:s") . " envoi : OK : " . $value['email'] . "\n", 3, "newsletterspy.log"); //echo "envoi OK : ". $value['email'] ."<br>"; } else { $newsletter->journalNewsletterDetailAdd($id_journal, $_to, null, 'bad email'); error_log(date("Y-m-d H:i:s") . " envoi : KO : " . $value['email'] . "\n", 3, "newsletterspy.log"); //echo "XXXX envoi KO : ". $value['email'] ."<br>"; }
public function contactAdd($value) { //print_r($value);exit(); $this->dbConnect(); $this->begin(); try { !empty($value['newsletter']) && $value['newsletter'] == 'on' ? $newsletter = 1 : ($newsletter = 0); !empty($value['fromgoldbook']) && $value['fromgoldbook'] == 'on' ? $fromgoldbook = 1 : ($fromgoldbook = 0); !empty($value['fromcontact']) && $value['fromcontact'] == 'on' ? $fromcontact = 1 : ($fromcontact = 0); $sql = "INSERT INTO .`contact`\n\t\t\t\t\t\t(`name`, `email`, `firstname`,`password`,`newsletter`,`fromgoldbook`,`fromcontact`)\n\t\t\t\t\t\tVALUES (\n\t\t\t\t\t\t'" . addslashes($value['name']) . "',\n\t\t\t\t\t\t'" . addslashes($value['email']) . "',\n\t\t\t\t\t\t'" . addslashes($value['firstname']) . "',\n\t\t\t\t\t\t'" . randomChar(5) . "',\n\t\t\t\t\t\t" . $newsletter . ",\n\t\t\t\t\t\t" . $fromgoldbook . ",\n\t\t\t\t\t\t" . $fromcontact . "\n\t\t\t\t\t);"; // error_log(date("Y-m-d H:i:s") ." : ".$sql."\n", 3, "../log/spy.log"); $result = mysqli_query($this->mysqli, $sql); if (!$result) { throw new Exception($sql); } $id_record = mysqli_insert_id($this->mysqli); $this->commit(); } catch (Exception $e) { $this->rollback(); throw new Exception("Erreur Mysql contactAdd " . $e->getMessage()); return "errrrrrrooooOOor"; } $this->dbDisConnect(); return $id_record; }