"; //champ checkbox non coche si obligatoire $errno2 = "Erreur : Champ obligatoire --> "; //champ text|password|textarea vide si obligatoire $errno3 = "Erreur : Saisie incorrect --> "; //REGEXP fausse dans champ text|password|textarea $errno4 = "Erreur : Envoie du fichier obligatoire --> "; //piece jointe non uploder si obligatoire $errno5 = "Erreur : Confirmez le mot de passe"; //Si confirmation du mot de passe vide $errno6 = "Erreur : Confirmation du mot de passe incorrect"; //si confirmation du mot de passe incorrecte $errno7 = "Erreur : Captcha incorrect"; //Si captcha incorrect $errno8 = "Erreur : Synthaxe de sendmail incorrect"; //Synthaxe de sendmail incorrect $errno9 = "Erreur : Argument obligatoire manquant"; //Argument obligatoire manquant lors de l'appel a "addField" et "Create // Erreurs Javascript : $errno10 = ''; //champ text|password|textarea vide si obligatoire ou REGEXP fausse $errno11 = "Confirmation du mot de passe incorrect"; //confirmation du mot de passe incorrecte $errno12 = "Fichier obligatoire"; //piece jointe non uploder si obligatoire $errno13 = "Choix incorrect"; //champ checkbox | radio non coche si obligatoire //////////////////////////VARIABLES DIVERS PHP////////////////// $legend = 'Les champs blancs sont obligatoires'; // Legende fin de formulaire comme '* Champs obligatoire' $labelObl = ""; // rajoute ces caracteres au labels obligatoire; $size_tab = 0; // taille bordure tableau si activer (par default 1) $pageFormulaire = '$_SERVER["PHP_SELF"]'; // page ou est rediriger le formulaire (par default elle meme : $_SERVER['PHP_SELF'] / mais avec thelia les addresses de page ont une synthaxe special ex:?fond=ami.php) $fieldMsg = "all"; // nom du champ par default contenant le message a envoyer par mail. mettre "all" pour envoyer tout les champs dans cette form : nom du champ => valeur... // Liste CLASS PHP : $classno1 = "form_erreur_php"; // erreur php $classno7 = "msgSendmail"; // class du message de succes ou d'echec d'envoie de mail de Sendmail // Liste CLASS Javascript : $classno2 = "form_erreur_js"; // erreur Javascript $classno3 = "form_correct"; // champs correct apres validation $classno4 = "form_incorrect"; // champs incorrect apres validation $classno5 = "form_pair"; // ligne pair en cas de tableau $classno6 = "form_impaire"; // ligne impaire en cas de tableau /////////////////////////////CLASS DIVERS////////// //$classLegend = "form_legend"; $classLegend = "legendForm"; // classLabel pour label champs // bouton id pour personalisation bouton envoyer ////////////////////////////////////////////////////////////////////////////////SIMPLEMAIL///////////////////////////////////////////////////////////////////// class simplemail { var $recipient; var $subject; var $hfrom; var $headers; var $hbcc; var $hcc; var $text; var $html; var $attachement; var $htmlattachement; var $error_log; function simplemail() { $this -> attachement = array(); $this -> htmlattachement = array(); } function checkaddress($address) { if ( preg_match("`[0-9a-zA-Z\.\-_]+@[0-9a-zA-z\-]{3,}\.[a-z]{2,4}`" , $address ) ) { return TRUE; } else { $this->error_log.="l'adresse $address est invalide\n"; return FALSE; } } function checkname($name) { if ( preg_match("`[0-9a-zA-Z\.\-_ ]*`" , $name ) ) { return TRUE; } else { $this->error_log.=" le pseudo $name est invalide\n"; return FALSE; } } function makenameplusaddress($address,$name) { if ( !$this->checkaddress($address) ) return FALSE; if ( !$this->checkname($name) ) return FALSE; if ( empty($name) ) { return $address; } else { $tmp=$name." <".$address.">"; return $tmp; } } function addrecipient($newrecipient,$name='') { $tmp=$this->makenameplusaddress($newrecipient,$name); if ( !$tmp ) { $this->error_log.=" To: error\n"; return FALSE; } if ( !empty($this->recipient) ) $this->recipient.= ","; $this->recipient.= $tmp; return TRUE; } function addbcc($bcc,$name='') { $tmp=$thi->makenameplusaddress($bcc,$name); if ( !$tmp ) { $this->error_log.=" Bcc: error\n"; return FALSE; } if ( !empty($this->hbcc)) $this->hbcc.= ","; $this->hbcc.= $tmp; return TRUE; } function addcc($cc,$name='') { $tmp=$this->makenameplusaddress($cc,$name); if ( !$tmp ) { $this->error_log.=" Cc: error\n"; return FALSE; } if (!empty($this->hcc)) $this->hcc.= ","; $this->hcc.= $tmp; return TRUE; } function addsubject($subject) { if (!empty($subject)) $this->subject= $subject; } function addfrom($from,$name='') { $tmp=$this->makenameplusaddress($from,$name); if ( !$tmp ) { $this->error_log.=" From: error\n"; return FALSE; } $this->hfrom = $tmp; return TRUE; } function addreturnpath($return) { $tmp=$this->makenameplusaddress($return,''); if ( !$tmp ) { $this->error_log.=" Return-Path: error\n"; return FALSE; } $this->returnpath = $return; return TRUE; } function addreplyto($replyto) { $tmp=$this->makenameplusaddress($replyto,''); if ( !$tmp ) { $this->error_log.=" Reply-To: error\n"; return FALSE; } $this->returnpath = $tmp; return TRUE; } // les attachements function addattachement($filename) { array_push ( $this -> attachement , array ( 'filename'=> $filename ) ); } // les attachements html function addhtmlattachement($filename,$cid='',$contenttype='') { array_push ( $this -> htmlattachement , array ( 'filename'=>$filename , 'cid'=>$cid , 'contenttype'=>$contenttype ) ); } function sendmail() { if ( empty($this->recipient) ) { $this->error_log.="destinataire manquant\n"; return FALSE; } if ( empty($this->subject) ) { $this->error_log.="sujet manquant\n"; return FALSE; } if ( !empty($this->hfrom) ) $headers.= "From: ".$this->hfrom."\n"; if ( !empty($this->returnpath) ) $headers.= "Return-Path: ".$this->returnpath."\n"; if ( !empty($this->replyto) ) $headers.= "Reply-To: ".$this->replyto."\n"; // if ( !empty($this->hcc) ) $headers.= "Cc: ".$this->hcc."\n"; // if ( !empty($this->hbcc) ) $headers.= "Bcc: ".$this->hbcc."\n"; $headers .="MIME-Version: 1.0\n"; //echo $headers; if ( !$this->html && $this->text ) { $B1B="----=_001"; $headers.="Content-Type: multipart/mixed;\n\t boundary=\"".$B1B."\"\n"; if ( !empty($this->hcc) ) $headers.= "Cc: ".$this->hcc."\n"; if ( !empty($this->hbcc) ) $headers.= "Bcc: ".$this->hbcc."\n"; //Messages start with text/html alternatives in OB $message ="This is a multi-part message in MIME format.\n"; $message.="\n--".$B1B."\n"; $message.="Content-Type: text/plain; charset=\"iso-8859-1\"\n"; $message.="Content-Transfer-Encoding: quoted-printable\n\n"; // plaintext goes here $message.=$this->text."\n\n"; if ( !empty($this->attachement) ) { foreach($this->attachement as $AttmFile){ $patharray = explode ("/", $AttmFile['filename']); $FileName=$patharray[count($patharray)-1]; $message.= "\n--".$B1B."\n"; $message.="Content-Type: application/octetstream;\n name=\"".$FileName."\"\n"; $message.="Content-Transfer-Encoding: base64\n"; $message.="Content-Disposition: attachment;\n filename=\"".$FileName."\"\n\n"; $fd=fopen ($AttmFile['filename'], "rb"); $FileContent=fread($fd,filesize($AttmFile['filename'])); fclose ($fd); $FileContent=chunk_split(base64_encode($FileContent)); $message.=$FileContent; $message.="\n\n"; } } //message ends $message.="\n--".$B1B."--\n"; } elseif ( $this->html ) { $B1B="----=_001"; $B2B="----=_002"; $B3B="----=_003"; if ( !$this->text ) { $this->text="HTML only!"; } $headers.="Content-Type: multipart/mixed;\n\t boundary=\"".$B1B."\"\n"; if ( !empty($this->hcc) ) $headers.= "Cc: ".$this->hcc."\n"; if ( !empty($this->hbcc) ) $headers.= "Bcc: ".$this->hbcc."\n"; //Messages start with text/html alternatives in OB $message ="This is a multi-part message in MIME format.\n"; $message.="\n--".$B1B."\n"; $message.="Content-Type: multipart/related;\n\t boundary=\"".$B2B."\"\n\n"; //plaintext section $message.="\n--".$B2B."\n"; $message.="Content-Type: multipart/alternative;\n\t boundary=\"".$B3B."\"\n\n"; //plaintext section $message.="\n--".$B3B."\n"; $message.="Content-Type: text/plain; charset=\"utf-8\"\n"; $message.="Content-Transfer-Encoding: quoted-printable\n\n"; // plaintext goes here $message.=$this->text."\n\n"; // html section $message.="\n--".$B3B."\n"; $message.="Content-Type: text/html; charset=\"utf-8\"\n"; $message.="Content-Transfer-Encoding: base64\n\n"; // html goes here $message.=chunk_split(base64_encode($this->html))."\n\n"; // end of text $message.="\n--".$B3B."--\n"; // attachments html if ( !empty($this->htmlattachement) ) { foreach($this->htmlattachement as $AttmFile){ $patharray = explode ("/", $AttmFile['filename']); $FileName=$patharray[count($patharray)-1]; $message.= "\n--".$B2B."\n"; $message.="Content-Type: {$AttmFile['contenttype']};\n name=\"".$FileName."\"\n"; $message.="Content-Transfer-Encoding: base64\n"; $message.="Content-ID: <{$AttmFile['cid']}>\n"; $message.="Content-Disposition: inline;\n filename=\"".$FileName."\"\n\n"; $fd=fopen ($AttmFile['filename'], "rb"); $FileContent=fread($fd,filesize($AttmFile['filename'])); fclose ($fd); $FileContent=chunk_split(base64_encode($FileContent)); $message.=$FileContent; $message.="\n\n"; } } //html ends $message.="\n--".$B2B."--\n"; if ( !empty($this->attachement) ) { foreach($this->attachement as $AttmFile){ $patharray = explode ("/", $AttmFile['filename']); $FileName=$patharray[count($patharray)-1]; $message.= "\n--".$B1B."\n"; $message.="Content-Type: application/octetstream;\n name=\"".$FileName."\"\n"; $message.="Content-Transfer-Encoding: base64\n"; $message.="Content-Disposition: attachment;\n filename=\"".$FileName."\"\n\n"; $fd=fopen ($AttmFile['filename'], "rb"); $FileContent=fread($fd,filesize($AttmFile['filename'])); fclose ($fd); $FileContent=chunk_split(base64_encode($FileContent)); $message.=$FileContent; $message.="\n\n"; } } //message ends $message.="\n--".$B1B."--\n"; } $recipient=$this->recipient; $subject=$this->subject; if ( @mail($recipient, $subject, $message, $headers) ) { return TRUE; } else { return FALSE; } } } //////////////////////////////////////////////////////////////////////////////////RECAPTCHA/////////////////////////////////////////////////////////////////// /* * This is a PHP library that handles calling reCAPTCHA. * - Documentation and latest version * http://recaptcha.net/plugins/php/ * - Get a reCAPTCHA API Key * https://www.google.com/recaptcha/admin/create * - Discussion group * http://groups.google.com/group/recaptcha * * Copyright (c) 2007 reCAPTCHA -- http://recaptcha.net * AUTHORS: * Mike Crawford * Ben Maurer * * Permission is hereby granted, free of charge, to any person obtaining a copy * of this software and associated documentation files (the "Software"), to deal * in the Software without restriction, including without limitation the rights * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell * copies of the Software, and to permit persons to whom the Software is * furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * THE SOFTWARE. */ /** * The reCAPTCHA server URL's */ define("RECAPTCHA_API_SERVER", "http://www.google.com/recaptcha/api"); define("RECAPTCHA_API_SECURE_SERVER", "https://www.google.com/recaptcha/api"); define("RECAPTCHA_VERIFY_SERVER", "www.google.com"); /** * Encodes the given data into a query string format * @param $data - array of string elements to be encoded * @return string - encoded request */ function _recaptcha_qsencode ($data) { $req = ""; foreach ( $data as $key => $value ) $req .= $key . '=' . urlencode( stripslashes($value) ) . '&'; // Cut the last '&' $req=substr($req,0,strlen($req)-1); return $req; } /** * Submits an HTTP POST to a reCAPTCHA server * @param string $host * @param string $path * @param array $data * @param int port * @return array response */ function _recaptcha_http_post($host, $path, $data, $port = 80) { $req = _recaptcha_qsencode ($data); $http_request = "POST $path HTTP/1.0\r\n"; $http_request .= "Host: $host\r\n"; $http_request .= "Content-Type: application/x-www-form-urlencoded;\r\n"; $http_request .= "Content-Length: " . strlen($req) . "\r\n"; $http_request .= "User-Agent: reCAPTCHA/PHP\r\n"; $http_request .= "\r\n"; $http_request .= $req; $response = ''; if( false == ( $fs = @fsockopen($host, $port, $errno, $errstr, 10) ) ) { die ('Could not open socket'); } fwrite($fs, $http_request); while ( !feof($fs) ) $response .= fgets($fs, 1160); // One TCP-IP packet fclose($fs); $response = explode("\r\n\r\n", $response, 2); return $response; } /** * Gets the challenge HTML (javascript and non-javascript version). * This is called from the browser, and the resulting reCAPTCHA HTML widget * is embedded within the HTML form it was called from. * @param string $pubkey A public key for reCAPTCHA * @param string $error The error given by reCAPTCHA (optional, default is null) * @param boolean $use_ssl Should the request be made over ssl? (optional, default is false) * @return string - The HTML to be embedded in the user's form. */ function recaptcha_get_html ($pubkey, $error = null, $use_ssl = false) { if ($pubkey == null || $pubkey == '') { die ("To use reCAPTCHA you must get an API key from https://www.google.com/recaptcha/admin/create"); } if ($use_ssl) { $server = RECAPTCHA_API_SECURE_SERVER; } else { $server = RECAPTCHA_API_SERVER; } $errorpart = ""; if ($error) { $errorpart = "&error=" . $error; } return ' '; } /** * A ReCaptchaResponse is returned from recaptcha_check_answer() */ class ReCaptchaResponse { var $is_valid; var $error; } /** * Calls an HTTP POST function to verify if the user's guess was correct * @param string $privkey * @param string $remoteip * @param string $challenge * @param string $response * @param array $extra_params an array of extra variables to post to the server * @return ReCaptchaResponse */ function recaptcha_check_answer ($privkey, $remoteip, $challenge, $response, $extra_params = array()) { if ($privkey == null || $privkey == '') { die ("To use reCAPTCHA you must get an API key from https://www.google.com/recaptcha/admin/create"); } if ($remoteip == null || $remoteip == '') { die ("For security reasons, you must pass the remote ip to reCAPTCHA"); } //discard spam submissions if ($challenge == null || strlen($challenge) == 0 || $response == null || strlen($response) == 0) { $recaptcha_response = new ReCaptchaResponse(); $recaptcha_response->is_valid = false; $recaptcha_response->error = 'incorrect-captcha-sol'; return $recaptcha_response; } $response = _recaptcha_http_post (RECAPTCHA_VERIFY_SERVER, "/recaptcha/api/verify", array ( 'privatekey' => $privkey, 'remoteip' => $remoteip, 'challenge' => $challenge, 'response' => $response ) + $extra_params ); $answers = explode ("\n", $response [1]); $recaptcha_response = new ReCaptchaResponse(); if (trim ($answers [0]) == 'true') { $recaptcha_response->is_valid = true; } else { $recaptcha_response->is_valid = false; $recaptcha_response->error = $answers [1]; } return $recaptcha_response; } /** * gets a URL where the user can sign up for reCAPTCHA. If your application * has a configuration page where you enter a key, you should provide a link * using this function. * @param string $domain The domain where the page is hosted * @param string $appname The name of your application */ function recaptcha_get_signup_url ($domain = null, $appname = null) { return "https://www.google.com/recaptcha/admin/create?" . _recaptcha_qsencode (array ('domains' => $domain, 'app' => $appname)); } function _recaptcha_aes_pad($val) { $block_size = 16; $numpad = $block_size - (strlen ($val) % $block_size); return str_pad($val, strlen ($val) + $numpad, chr($numpad)); } /* Mailhide related code */ function _recaptcha_aes_encrypt($val,$ky) { if (! function_exists ("mcrypt_encrypt")) { die ("To use reCAPTCHA Mailhide, you need to have the mcrypt php module installed."); } $mode=MCRYPT_MODE_CBC; $enc=MCRYPT_RIJNDAEL_128; $val=_recaptcha_aes_pad($val); return mcrypt_encrypt($enc, $ky, $val, $mode, "\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0"); } function _recaptcha_mailhide_urlbase64 ($x) { return strtr(base64_encode ($x), '+/', '-_'); } /* gets the reCAPTCHA Mailhide url for a given email, public key and private key */ function recaptcha_mailhide_url($pubkey, $privkey, $email) { if ($pubkey == '' || $pubkey == null || $privkey == "" || $privkey == null) { die ("To use reCAPTCHA Mailhide, you have to sign up for a public and private key, " . "you can do so at http://www.google.com/recaptcha/mailhide/apikey"); } $ky = pack('H*', $privkey); $cryptmail = _recaptcha_aes_encrypt ($email, $ky); return "http://www.google.com/recaptcha/mailhide/d?k=" . $pubkey . "&c=" . _recaptcha_mailhide_urlbase64 ($cryptmail); } /** * gets the parts of the email to expose to the user. * eg, given johndoe@example,com return ["john", "example.com"]. * the email is then displayed as john...@example.com */ function _recaptcha_mailhide_email_parts ($email) { $arr = preg_split("/@/", $email ); if (strlen ($arr[0]) <= 4) { $arr[0] = substr ($arr[0], 0, 1); } else if (strlen ($arr[0]) <= 6) { $arr[0] = substr ($arr[0], 0, 3); } else { $arr[0] = substr ($arr[0], 0, 4); } return $arr; } /** * Gets html to display an email address given a public an private key. * to get a key, go to: * * http://www.google.com/recaptcha/mailhide/apikey */ function recaptcha_mailhide_html($pubkey, $privkey, $email) { $emailparts = _recaptcha_mailhide_email_parts ($email); $url = recaptcha_mailhide_url ($pubkey, $privkey, $email); return htmlentities($emailparts[0]) . "...@" . htmlentities ($emailparts [1]); } //////////////////////////////////////////////////////////////////////FORMULAIRE/////////////////////////////////////////////////////////////////////////////// global $list_errors, $debug; $list_errors = array(); function getFieldValue ($action) { while (@preg_match('/\[field:[a-zA-Z0-9_. ]{1,}\]/', $action)) { //echo 'Av : '.$action.'
'; $splitVar = preg_split('/\[/', $action, -1, PREG_SPLIT_OFFSET_CAPTURE); $field = $splitVar[2][0]; $field = preg_split('/:/', $field, -1, PREG_SPLIT_OFFSET_CAPTURE); $field = $field[1][0]; $field = preg_split('/\]/', $field, -1, PREG_SPLIT_OFFSET_CAPTURE); $field = $field[0][0]; $action = preg_replace('/\[field:[a-zA-Z0-9_. ]{1,}\]/', $_POST[$field], $action, 1); //echo 'Ap : '.$action.'
'; } return $action; } if (isset($_POST['bouton'])) { if (isset($_SESSION['tab'])) { $file_name = array(); // stock champs des fichiers joint pour l'envoie de mail $tab = $_SESSION['tab']; $count = 0; while (isset($tab[$count])) { if (isset($_POST[$tab[$count][1]])) { $tab[$count][2] = $_POST[$tab[$count][1]]; } $count++; } $result = true; foreach ($tab as $value) { if ($value[0] == 'checkbox') { if ($value[3] == 1 && !isset($_POST[$value[1]])) { $result = false; array_push($list_errors, "".$errno1.$value[4]."
"); } } else if ($value[0] == 'text' || $value[0] == 'password' || $value[0] == 'textarea'){ $regexp = '#'.$value[7].'#'; if ($value[3] == 1 && !isset($_POST[$value[1]]) || $value[3] == 1 && $_POST[$value[1]] == '') { $result = false; array_push($list_errors,"".$errno2.$value[4]."
"); } if ($result) { if (@!preg_match($regexp, $value[2])) { $result = false; array_push($list_errors,"".$errno3.$value[4]."
"); } } } else if ($value[0] == 'file') { if ($value[3] == 1 && $_FILES[$value[1]]['error'] == UPLOAD_ERR_NO_FILE) { $result = false; array_push($list_errors, "".$errno4.$value[4]."
"); } else array_push($file_name, $value[1]); } else if ($value[0] == 'confirm' && isset($_POST[$value[5]]) && $_POST[$value[5]] != '') { if ($value[3] == 1 && !isset($_POST[$value[1]]) || $value[3] == 1 && $_POST[$value[1]] == '') { $result = false; array_push($list_errors,"".$errno5."
"); } if ($result) { if ($value[2] != $_POST[$value[5]]) { $result = false; array_push($list_errors, "".$errno6."
"); } } } } if (isset($_SESSION['captcha']) && $_SESSION['captcha'] == true) { $resp = recaptcha_check_answer ($_SESSION['privatekey'], $_SERVER["REMOTE_ADDR"], $_POST["recaptcha_challenge_field"], $_POST["recaptcha_response_field"]); if (!$resp->is_valid) { array_push($list_errors,"".$errno7."
"); $result = false; } } if ($result == true){ $sendmail = false; if (@preg_match('/^sendmail/', $_SESSION['action'])) { $_SESSION['action'] = getFieldValue($_SESSION['action']); if (@preg_match('/^sendmail\[from:[a-z0-9._-]+@[a-z0-9._-]{2,}\.[a-z]{2,4} to:[a-z0-9._-]+@[a-z0-9._-]{2,}\.[a-z]{2,4}(,( )?[a-z0-9._-]+@[a-z0-9._-]{2,}\.[a-z]{2,4})*\]$/', $_SESSION['action'])) { $split = preg_split('/:/', $_SESSION['action'], -1, PREG_SPLIT_OFFSET_CAPTURE); $tmpmailfrom = $split[1][0]; $tmpmailfrom = preg_split('/ /', $tmpmailfrom, -1, PREG_SPLIT_OFFSET_CAPTURE); $mailfrom = $tmpmailfrom[0][0]; $tmpmailto = $split[2][0]; $tmpmailto = preg_split('/\]/', $tmpmailto, -1, PREG_SPLIT_OFFSET_CAPTURE); $mailto = $tmpmailto[0][0]; $tmpnom = preg_split('/@/', $mailfrom, -1, PREG_SPLIT_OFFSET_CAPTURE); $nom = $tmpnom[0][0]; $sendmail = true; } else { echo "".$errno8."
"; return false; } } if ($sendmail) { if ($fieldMsg == "all") { foreach ($_POST as $key=>$value) { if ($value != '') $msg .= $key.' --> '.$value.'
'; } } else { foreach ($_POST as $key=>$value) { if ($key == $fieldMsg) $msg .= $value.'
'; } } /*$msg = 'Message :
'. $_POST['message'].'

Nom : '.$_POST['name'].'
Mail : '.$_POST['mail'].'
Téléphone : '.$_POST['phone'].'
Addresse : '.$_POST['add'].'
'; */ $msg = '
Vous venez de recevoir un message depuis le site www.boulogne.fm :

Civilité '.$_POST['civilite'].'
Nom '.$_POST['name'].'
Prénom '.$_POST['prenom'].'
Message : '.$_POST['message'].'
'.$nom.' '.$_POST['prenom'].'
'.$_POST['mail'].'
'.$_POST['add'].'
'.$_POST['codeP'].'
'.$_POST['ville'].'
'.$_POST['pays'].'
Tél.: '.$_POST['phone'].'
Fax: '.$_POST['fax'].'
'; //$msg = nl2br($msg); $adresse = $_SESSION['adresse']; $tel = $_SESSION['tel']; $sujet = 'Inscription'; $mail = new simplemail; foreach ($file_name as $field) { if ($_FILES[$field]['error'] != UPLOAD_ERR_NO_FILE) { move_uploaded_file($_FILES[$field]['tmp_name'],'./'.$_FILES[$field]['name']); $mail -> addattachement('./'.$_FILES[$field]['name']); } } $mail -> addrecipient($mailto); $mail -> addfrom('noreply@asd.es', $_POST['name']); $mail -> addsubject('Message depuis www.boulogne.fm - '.$_POST['obj']); // le message format html $message .= '
'; $message .= 'Nom : '.$nom.'
'; $message .= 'Adresse : '.$adresse.'
'; $message .= 'Mail : '.$mailfrom.'
'; $message .= 'Téléphone : '.$tel.'
'; $message .= '
Message :
'.stripslashes(nl2br($msg)).'
'; $message .= "
"; //On ajoute le message en format html $mail ->html = $msg; //On envoi if ( $mail -> sendmail() ) { $debug .= 'Votre e-mail a été correctement envoyé'; $_POST = array(); foreach ($file_name as $field) { if($_FILES[$field]['error'] != UPLOAD_ERR_NO_FILE) unlink('./'.$_FILES[$field]['name']); } } else { $debug .= ''.$mail->error_log.''; } //echo $debug; } else { $locat = "Location:".$_SESSION['action']; header($locat); echo ''; } } } } $tab = array(array()); class form{ function debug() { global $list_errors, $debug, $classno7; $errorPhp = '
'. $errorPhp .= $debug; for ($i = 0; $list_errors[$i]; $i++) {$errorPhp .= $list_errors[$i];} $errorPhp .= '
'; return $errorPhp; } function add_privatekey($key){ $_SESSION['privatekey'] = $key; } function add_publickey($key){ $_SESSION['publickey'] = $key; } function get_regex($exp){ $rep = $exp; switch ($exp) { case 'num': $rep = '^[0-9]*$'; break; case 'age': $rep = '^[1-9]{1}([0-9]?){1}$'; break; case 'tel': $rep = '^0[1-68]([-. ]?[0-9]{2}){4}$'; break; case 'mail': //$rep = '^[a-zA-Z0-9._-]+@[a-zA-Z0-9_-]{2,}\.[a-zA-Z]{2,4}$'; //$rep = '([a-zA-Z0-9]+(([\.\-\_]?[a-zA-Z0-9]+)+)?)\@(([a-zA-Z0-9]+[\.\-\_])+[a-zA-Z]{2,4})$'; // origin $rep = '([a-zA-Z0-9]+(([\.\-\_]?[a-zA-Z0-9]+)+)?)\@(([a-zA-Z0-9]+[\.])+[a-zA-Z]{2,4})$'; // modif break; break; case 'alphanum': $rep = '^[a-zA-Z0-9éèàç^¨ ]*$'; break; case 'alpha': $rep = '^[a-zA-Zéèàç^¨ ]*$'; break; case 'alphamin': $rep = '^[a-zéèàç^¨ ]*$'; break; case 'alphamax': $rep = '^[A-Z ]*$'; break; } return $rep; } function addField(){ $argc = func_num_args(); if ($argc < 3){ echo "".$errno9."
"; return (false); } $argv = func_get_args(); static $field = 0; global $tab, $labelObl; $obl = 0; $label = $argv[1]; $baliseBefore = ''; switch ($argv[0]) { case 'text': // PARAM OBLIGATOIRE : type / nom / value par defaut. OPTIONNEL : obligatoire (obl) / label / Expr Reguliere (mail - num - age - alphanum - alpha - alphamin - alphamax - tel) - ou perso (exp de type PCRE) $regex = '.*'; if ($argc >= 4 && $argv[3] == 'obl'){ $obl = 1;} if ($argc >= 5 && $argv[4] != ''){ $label = $argv[4]; if ($obl == 1) $label .= $labelObl;} if ($argc >= 6 && $argv[5] != ''){ $regex = $this->get_regex($argv[5]);} if ($argc >= 7 && $argv[6] != '') $baliseBefore = $argv[6]; $tab[$field][0] = $argv[0]; $tab[$field][1] = $argv[1]; $tab[$field][2] = $argv[2]; $tab[$field][3] = $obl; $tab[$field][4] = $label; $tab[$field][5] = 0; $tab[$field][6] = 0; $tab[$field][7] = $regex; $tab[$field][8] = $baliseBefore; $field++; break; case 'password': // PARAM OBLIGATOIRE : type / nom / value par defaut. OPTIONNEL : obligatoire (obl) / label / Expr Reguliere (mail - num - age - alphanum - alpha - alphamin - alphamax - tel) - ou perso (exp de type PCRE) $regex = '.*'; if ($argc >= 4 && $argv[3] == 'obl'){ $obl = 1;} if ($argc >= 5 && $argv[4] != ''){ $label = $argv[4]; if ($obl == 1) $label .= $labelObl;} if ($argc >= 6 && $argv[5] != ''){ $regex = $this->get_regex($argv[5]);} if ($argc >= 7 && $argv[6] != '') $baliseBefore = $argv[6]; $tab[$field][0] = $argv[0]; $tab[$field][1] = $argv[1]; $tab[$field][2] = $argv[2]; $tab[$field][3] = $obl; $tab[$field][4] = $label; $tab[$field][5] = 0; $tab[$field][6] = 0; $tab[$field][7] = $regex; $tab[$field][8] = $baliseBefore; $field++; break; case 'confirm': // PARAM OBLIGATOIRE : type / nom du champ a confirmer OPTIONNEL : value par defaut / label (AUTOMATIQUEMENT OBLIGATOIRE) $regex = '.*'; $value = ''; if ($argc >= 3 && $argv[2] != ''){ $value = $argv[2];} if ($argc >= 4 && $argv[3] != ''){ $label = $argv[3]; if ($obl == 0) $label .= $labelObl;} if ($argc >= 5 && $argv[4] != '') $baliseBefore = $argv[4]; $tab[$field][0] = $argv[0]; $tab[$field][1] = 'confpass'; $tab[$field][2] = $value; $tab[$field][3] = 1; $tab[$field][4] = $label; $tab[$field][5] = $argv[1]; $tab[$field][6] = 0; $tab[$field][7] = $regex; $tab[$field][8] = $baliseBefore; $field++; break; case 'radio': // PARAM OBLIGATOIRE : type / nom / value par defaut differentes entres elles. OPTIONNEL : obligatoire (obl) / label / default $regex = '.*'; $default = 0; if ($argc >= 4 && $argv[3] == 'obl'){ $obl = 1; } if ($argc >= 5 && $argv[4] != ''){ $label = $argv[4]; if ($obl == 1) $label .= $labelObl;} if ($argc >= 6 && $argv[5] == 'default'){ $default = 1; } if ($argc >= 7 && $argv[6] != '') $baliseBefore = $argv[6]; $tab[$field][0] = $argv[0]; $tab[$field][1] = $argv[1]; $tab[$field][2] = $argv[2]; $tab[$field][3] = $obl; $tab[$field][4] = $label; $tab[$field][5] = $default; $tab[$field][6] = 0; $tab[$field][7] = $regex; $tab[$field][8] = $baliseBefore; $field++; break; case 'checkbox': // PARAM OBLIGATOIRE : type / nom / value par defaut. OPTIONNEL : obligatoire (obl) / label / checked $regex = '.*'; $checked = 0; if ($argc >= 4 && $argv[3] == 'obl'){ $obl = 1; } if ($argc >= 5 && $argv[4] != ''){ $label = $argv[4]; if ($obl == 1) $label .= $labelObl;} if ($argc >= 6 && $argv[5] == 'checked'){ $checked = 1; } if ($argc >= 7 && $argv[6] != '') $baliseBefore = $argv[6]; $tab[$field][0] = $argv[0]; $tab[$field][1] = $argv[1]; $tab[$field][2] = $argv[2]; $tab[$field][3] = $obl; $tab[$field][4] = $label; $tab[$field][5] = $checked; $tab[$field][6] = 0; $tab[$field][7] = $regex; $tab[$field][8] = $baliseBefore; $field++; break; case 'textarea': // OBLIGATOIRE : type / nom / valeur du texte par defaut. OPTIONNEL : obligatoire (obl) / label / rows / cols / Expr Reguliere (mail - num - age - alphanum - alpha - alphamin - alphamax - tel) - ou perso (exp de type PCRE) $regex = '.*'; $rows = 5; $cols = 5; if ($argc >= 4 && $argv[3] == 'obl'){ $obl = 1; } if ($argc >= 5 && $argv[4] != ''){ $label = $argv[4]; if ($obl == 1) $label .= $labelObl;} if ($argc >= 6){ $rows = $argv[5]; } if ($argc >= 7){ $cols = $argv[6]; } if ($argc >= 8 && $argv[7] != ''){ $regex = $this->get_regex($argv[7]);} if ($argc >= 9 && $argv[8] != '') $baliseBefore = $argv[8]; $tab[$field][0] = $argv[0]; $tab[$field][1] = $argv[1]; $tab[$field][2] = $argv[2]; $tab[$field][3] = $obl; $tab[$field][4] = $label; $tab[$field][5] = $rows; $tab[$field][6] = $cols; $tab[$field][7] = $regex; $tab[$field][8] = $baliseBefore; $field++; break; case 'select': // PARAM OBLIGATOIRE : type / nom / Tableau des choix OPTIONNEL : obligatoire (obl) / label $regex = '.*'; if ($argc >= 4 && $argv[3] == 'obl'){ $obl = 1; } if ($argc >= 5 && $argv[4] != ''){ $label = $argv[4]; if ($obl == 1) $label .= $labelObl;} if ($argc >= 6 && $argv[5] != '') $baliseBefore = $argv[5]; $tab[$field][0] = $argv[0]; $tab[$field][1] = $argv[1]; $tab[$field][2] = $argv[2]; $tab[$field][3] = $obl; $tab[$field][4] = $label; $tab[$field][5] = 0; $tab[$field][6] = 0; $tab[$field][7] = $regex; $tab[$field][8] = $baliseBefore; $field++; break; case 'file': // PARAM OBLIGATOIRE : type / nom OPTIONNEL : obligatoire (obl) / label if ($argc >= 3 && $argv[2] == 'obl'){ $obl = 1;} if ($argc >= 4 && $argv[3] != ''){ $label = $argv[3]; if ($obl == 1) $label .= $labelObl;} if ($argc >= 5 && $argv[4] != '') $baliseBefore = $argv[4]; $tab[$field][0] = $argv[0]; $tab[$field][1] = $argv[1]; $tab[$field][2] = 0; $tab[$field][3] = $obl; $tab[$field][4] = $label; $tab[$field][5] = 0; $tab[$field][6] = 0; $tab[$field][7] = $regex; $tab[$field][8] = $baliseBefore; $field++; break; } } function Create(){ /*PARAM OBLIGATOIRE : Nom|id du formulaire / action (sendmail[from: to:]) ou (sendmail[from:[nom du champ] to:[nom du champ]]) pour envoyer mail | OPTIONNEL : tableau (tab) / NOM_BOUTON_ENVOYER / BOUTON_EFFACER (clear) / LIEN IMAGE BOUTON ENVOYER / Captcha (captcha)*/ // balise before form puis apres form global $tab, $errno10, $errno11, $errno12, $errno13, $classno2, $classno3, $classno4, $classno5, $classno6, $classno7, $legend, $size_tab, $classLegend; $argc = func_num_args(); if ($argc < 2){ echo "".$errno9."
"; return (false); } $argv = func_get_args(); $_SESSION['action'] = $argv[1]; $_SESSION['captcha'] = false; $baliseBeforeForm = ''; $baliseAfterForm = ''; if ($argc >= 8 && $argv[7] != '') $baliseBeforeForm = $argv[7]; if ($argc >= 9 && $argv[8] != '') $baliseAfterForm = $argv[8]; if ($argc >= 7 && $argv[6] == 'captcha') $_SESSION['captcha'] = true; echo ''; $in_tab = 0; if ($argc >= 3 && $argv[2] == 'tab'){ $in_tab = 1;} $nbr_field = sizeof($tab); $count = 0; $color_line = array ($classno5, $classno6); $select_color = 0; echo '
'; if ($in_tab == 1) echo ''; while ($count < $nbr_field) { switch ($tab[$count][0]) { case 'text': if(isset($_POST[$tab[$count][8]])) $tab[$count][8] = $_POST[$tab[$count][8]]; echo $tab[$count][8]; if(isset($_POST[$tab[$count][1]])) $tab[$count][2] = $_POST[$tab[$count][1]]; if ($in_tab == 1) echo ''; else echo ''; $count++; break; case 'password': if(isset($_POST[$tab[$count][8]])) $tab[$count][8] = $_POST[$tab[$count][8]]; echo $tab[$count][8]; if(isset($_POST[$tab[$count][1]])) $tab[$count][2] = $_POST[$tab[$count][1]]; if ($in_tab == 1) echo ''; else echo ''; $count++; break; case 'confirm': if(isset($_POST[$tab[$count][8]])) $tab[$count][8] = $_POST[$tab[$count][8]]; echo $tab[$count][8]; if(isset($_POST[$tab[$count][1]])) $tab[$count][2] = $_POST[$tab[$count][1]]; if ($in_tab == 1) echo ''; else echo ''; $count++; break; case 'file': if(isset($_POST[$tab[$count][8]])) $tab[$count][8] = $_POST[$tab[$count][8]]; echo $tab[$count][8]; if(isset($_POST[$tab[$count][1]])) $tab[$count][2] = $_POST[$tab[$count][1]]; if ($in_tab == 1) echo ''; else echo ''; $count++; break; case 'radio': if(isset($_POST[$tab[$count][8]])) $tab[$count][8] = $_POST[$tab[$count][8]]; echo $tab[$count][8]; if(isset($_POST[$tab[$count][1]]) && $_POST[$tab[$count][1]] == $tab[$count][2]) $tab[$count][5] = 1; if ($in_tab == 1){ echo '';} else { echo ''.$errno13.'';} $count++; break; case 'checkbox': if(isset($_POST[$tab[$count][8]])) $tab[$count][8] = $_POST[$tab[$count][8]]; echo $tab[$count][8]; if(isset($_POST[$tab[$count][1]]) && $_POST[$tab[$count][1]] == $tab[$count][2]) $tab[$count][5] = 1; if ($in_tab == 1){ echo '';} else { echo ''.$errno13.'/>';} $count++; break; case 'textarea': if(isset($_POST[$tab[$count][8]])) $tab[$count][8] = $_POST[$tab[$count][8]]; echo $tab[$count][8]; if(isset($_POST[$tab[$count][1]])) $tab[$count][2] = $_POST[$tab[$count][1]]; if ($in_tab == 1) echo ''; else echo ''; $count++; break; case 'select': if(isset($_POST[$tab[$count][8]])) $tab[$count][8] = $_POST[$tab[$count][8]]; echo $tab[$count][8]; $nbr_elem = sizeof($tab[$count][2]); $count2 = 0; if ($in_tab == 1) echo ''; $count++; break; } if ($select_color == $classno5) $select_color = 1; else $select_color = 0; } if ($_SESSION['captcha'] == true) { if ($in_tab == 1) echo ''; } if ($select_color == $classno5) $select_color = 1; else $select_color = 0; echo $baliseBeforeForm; $valid = 'Envoyer'; if ($argc >= 4) $valid = $argv[3]; if ($in_tab == 1) echo '
'.$errno10.'
'; while ($count2 < $nbr_elem) { if(isset($_POST[$tab[$count][1]]) && $_POST[$tab[$count][1]] == $tab[$count][2][$count2]) echo ''; else echo ''; $count2++; } echo ''; if ($in_tab == 1) echo '
'; echo recaptcha_get_html($_SESSION['publickey']); if ($in_tab == 1) echo '
'; if ($in_tab == 1) echo ''; if ($argc >= 6 && $argv[5] != '') echo ''; else echo ''; if ($argc >= 5 && $argv[4] == 'clear'){ echo '';} echo '
'.$legend.'
'; if ($in_tab == 1) echo '
'; echo $baliseAfterForm; echo '
'; $_SESSION['tab'] = $tab; $affJAS = ""; echo $affJAS; } } ?> Contact | L'univers de D@niel Boulogne
Bienvenue sur le portail de Daniel Boulogne dédié aux événements, l'art, le vin et les murs peints

Boutique

BOULOGNE.FM


Domaine le Déroc
24190 VALLEREUIL
FRANCE

Daniel Boulogne
daniel@boulogne.fm
+33 (0) 6 58 52 74 98
www.boulogne.fm




debug(); $tab = Array('Madame', 'Mademoiselle', 'Monsieur'); $form->addField('select', 'civilite', $tab, 'obl', 'Civilité', '
'); $form->addField('text', 'name', '', 'obl', 'Nom', '', '
'); $form->addField('text', 'prenom', '', '', 'Prénom', '', '
'); $form->addField('text', 'add', '', '', 'Adresse', '', '
'); $form->addField('text', 'mail', '', 'obl', 'E-mail', 'mail', '
'); $form->addField('text', 'ville', '', 'obl', 'Ville', '', '
'); $form->addField('text', 'codeP', '', 'obl', 'CP', 'num', '
'); $form->addField('text', 'pays', '', '', 'Pays', '', '
'); $form->addField('text', 'phone', '', '', 'Téléphone', 'num', '
'); $form->addField('text', 'fax', '', '', 'Fax', 'num', '
'); $form->addField('text', 'obj', '', 'obl', 'Objet', '', '
'); $form->addField('textarea', 'message', '', 'obl', 'Message', '5', '25', '', '
'); $form->create('form_form', 'sendmail[from:[field:mail] to:daniel@boulogne.fm]', '', 'ENVOYER','', '', '', '
', '
'); ?>

Qui est Daniel Boulogne ?   Mentions légales   CGV   Réalisation : little Big Studio