X
Futur bachelier?
L'EIML Paris est accessible hors Parcoursup
En savoir plus
JPO Digitale
Participez aux portes ouvertes de chez vous
Je m’inscris
"6Lfrlh4TAAAAAObpTvhMCMdUN1O6oh7_IcxHImX4", 'response' => $code ); if( $ip ){ $params['remoteip'] = $ip; } $url = "https://www.google.com/recaptcha/api/siteverify?" . http_build_query($params); if (function_exists('curl_version')) { $curl = curl_init($url); curl_setopt($curl, CURLOPT_HEADER, false); curl_setopt($curl, CURLOPT_RETURNTRANSFER, true); curl_setopt($curl, CURLOPT_TIMEOUT, 1); curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, false); // Evite les problèmes, si le ser $response = curl_exec($curl); } else { // Si curl n'est pas dispo, un bon vieux file_get_contents $response = file_get_contents($url); } if (empty($response) || is_null($response)) { return false; } $json = json_decode($response); return $json->success; } if( $recaptcha === false || isValid( $recaptcha ) == false && ( WP_ENV != 'development' && WP_ENV != 'local' ) ) { $html_fail[ $html_fail_index ] = 'Mauvaise saisie du Captcha. Veuillez réessayer.'; $html_fail_index++; echo checkForm($html_fail); return; } else { ///////////////////////////////////////////////////////////////////////////////////////////// ////////////////////////////// Fichiers de connexion ////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////// /* Database */ $database = DB_NAME; $dsn = 'mysql:host='.DB_HOST.';dbname='.$database.';charset=utf8'; $username = DB_USER; $password = DB_PASSWORD; $error = null; $options = [ PDO::ATTR_ERRMODE => PDO::ERRMODE_EXCEPTION ]; /* Connexion à la base de données - version PDO */ try { $connect_dtb_PDO = new PDO( $dsn, $username, $password, $options ); } catch (PDOException $exception) { $error = $exception->getMessage(); } if ($error) { $html_fail[ $html_fail_index ] = 'Erreur de connexion (' . $error .') '; $html_fail_index++; echo checkForm($html_fail); return; } ////////////////////////////////////////////////////////////////////////////// ///////////// On récupère nos petites infos dans nos variables ////////////// //////////////////////////////////////////////////////////////////////////// $lastname = stripslashes($_POST['nom']); $firstname = stripslashes($_POST['prenom']); $email = stripslashes($_POST['email']); $phone = stripslashes($_POST['telephone']); $lastname_bdd = addslashes($lastname); $firstname_bdd = addslashes($firstname); /* START - REQUEST */ $tab = 'form_contact'; $req = $connect_dtb_PDO->prepare("INSERT INTO $tab (nom, prenom, mail, telephone, date_inscription) VALUES (:nom_r, :prenom_r, :mail_r, :telephone_r, NOW())"); $req->execute(array( 'nom_r' => $lastname, 'prenom_r' => $firstname, 'mail_r' => $email, 'telephone_r' => $phone, )); // $req->debugDumpParams(); /* END - REQUEST */ //////////////////////////////////////////////////////////////////// //////////////////// On envoie la confirmation //////////////////// //////////////////////////////////////////////////////////////////// $TO2 = $email; $subject2 = "Contact - Demande de contact"; $mail_entete2 = 'MIME-Version: 1.0' . "\r\n"; $mail_entete2 .= 'Content-type: text/html; charset=utf-8' . "\r\n"; $mail_entete2 .= "From: " . $TO2; $mail_entete2 .= "\r\nContent-Transfer-Encoding: 8bit\r\n"; $mail_entete2 .= 'X-Mailer:PHP/' . phpversion()."\r\n"; $message_mail2 = ''; $message_mail2 .= '
Demande de Contact :
Nom '.stripslashes($lastname).'
Prénom '.stripslashes($firstname).'
Email '.$email.'
Téléphone '.$phone.'
'; $message_mail2 .= ''; switch( WP_ENV ){ case "development": mail("devweb@reseau-ges.fr", $subject2, $message_mail2, $mail_entete2); break; case "preprod": mail("devweb@reseau-ges.fr", $subject2, $message_mail2, $mail_entete2); break; default: mail("tsimon4@reseau-ges.fr", $subject2, $message_mail2, $mail_entete2); mail("enicolas2@reseau-ges.fr", $subject2, $message_mail2, $mail_entete2); break; } } function checkForm( $html_fail ){ $error = '
'; if( !empty( $html_fail ) ){ $error .= '
'; $error .= '
    '; foreach( $html_fail as $key => $value ){ $error .= '
  • '; $error .= $value ; $error .= '
  • '; } $error .= '
'; $error .= '
'; $error .=''; $error .='retour au formualaire'; $error .=''; $error .='
'; return $error; } } ?>
200