Exemplo n.º 1
0
 if ($okTime && $okCookie && $okAutoPost && (isset($_POST["subject"]) && isset($_POST["question"]) && isset($_POST["message"]) && isset($_POST["captcha"]))) {
     if (!GsbUtilisateur::estConnecte()) {
         $name = $_POST["name"];
         $email = $_POST["email"];
         $valid_name = OutilsForm::valideNom($_POST["name"]);
         $valid_email = OutilsForm::valideEmail($_POST["email"]);
     }
     $subject = $_POST["subject"];
     $question = $_POST["question"];
     $message = $_POST["message"];
     // Si la clé du formilaire n'est pas valide
     $okPost = true;
     $valid_captcha = OutilsForm::valideCaptcha($_POST["captcha"]);
     $valid_subject = OutilsForm::valideSujet($_POST["subject"]);
     $valid_question = OutilsForm::valideSelect($_POST["question"], array("question", "remarque", "erreur"));
     $valid_message = OutilsForm::valideMessage($_POST["message"]);
     if (OutilsForm::valideFormulaireId("contact") && $valid_name && $valid_email && $valid_subject && $valid_question && $valid_message && $valid_captcha == 1) {
         $okForm = true;
         OutilsForm::resetCaptcha();
         $_SESSION['ContactEnvoye'] = true;
         $_SESSION['ContactEnvoyeTime'] = time();
         $headers = 'Content-Type: text/plan; charset="utf-8"' . "\r\n" . 'Content-Transfer-Encoding: 8bit' . "\r\n" . 'MIME-Version: 1.0' . "\r\n" . 'From: ' . $name . ' <' . $email . '>' . "\r\n" . 'Reply-To: ' . $name . ' <' . $email . '>' . "\r\n" . 'X-Mailer: PHP/' . phpversion();
         $subject = "Contact " . GsbConfig::$SiteShortUrl . " : " . $subject;
         $message = '[Mail from ' . GsbConfig::$SiteShortUrl . ']' . "\r\n\r\n" . 'Nom: ' . $name . "\r\n" . 'Sujet: ' . $subject . "\r\n" . 'Email: ' . $email . "\r\n\r\n" . 'Message' . "\r\n" . '--------' . "\r\n" . $message . "\r\n" . '--------' . "\r\n\r\n" . "Le: " . date("d/m/Y") . " a: " . date("H:i");
         try {
             if (@mail($email_send, $subject, $message, $headers)) {
                 $okMail = true;
             }
         } catch (Exception $e) {
         }
         unset($_SESSION["FormContactHashkey"]);
Exemplo n.º 2
0
 $valid["dateVisite"] = OutilsForm::valideDate($dateVisite, time()) ? 1 : 0;
 //
 $choixPraticien = $_POST["choixPraticien"];
 $valid["choixPraticien"] = is_array(GsbModele::getLePraticienDetails($choixPraticien));
 //
 $bilan = $_POST["bilan"];
 $valid["bilan"] = OutilsForm::valideMessage($bilan);
 //
 $remplacant = isset($_POST["remplacant"]);
 $documentation = isset($_POST["documentation"]);
 //
 if (isset($_POST["motifAutre"])) {
     $motifAutre = $_POST["motifAutre"];
     $motifAutreActive = true;
     $choixMotif = "autre-saisie";
     $valid["motifAutre"] = OutilsForm::valideMessage($motifAutre, 128);
 } else {
     $choixMotif = $_POST["choixMotif"];
     $valid["choixMotif"] = $choixMotif >= 0 && count($lesMotifs) > $choixMotif ? 1 : 0;
 }
 // Si des échantillons sont envoyées
 if (!is_null($echantillonsMultidataForm["values"])) {
     $echantillonsFaits = array();
     foreach ($echantillonsMultidataForm["values"] as $saisieEchantillons) {
         $validEchantillons = validerSaisieEchantillons($saisieEchantillons["choixMedicament"], $saisieEchantillons["qteOfferte"]);
         if ($validEchantillons["choixMedicament"] == 1) {
             if (isset($echantillonsFaits[$saisieEchantillons["choixMedicament"]])) {
                 if ($echantillonsFaits[$saisieEchantillons["choixMedicament"]] == 1) {
                     $echantillonsMultidataForm["errors"][] = "L'echantillion code \"" . $saisieEchantillons["choixMedicament"] . "\" est renseigné une ou plusieurs fois";
                 }
                 $validEchantillons["echantillons"] = 0;