function checkEmail($email){ $syntaxe='#^[a-z0-9]+([_|\.|-|\+]{1}[a-z0-9]+)*@[a-z0-9]+([_|\.|-]{1}[a-z0-9]+)*[\.]{1}[a-z]{2,6}$#i'; if(preg_match($syntaxe,$email)){return true;}else{return false;} } $comment=''; $confirm=false; $test=true; if(isset($_POST['send'])){ foreach($_POST as $key=>$value){ $_POST[$key]=htmlentities($value); if($value==''){$test=false; $comment.='remplir champs '.$key.'';} } if($test){ if(checkEmail($_POST['email'])){ $to = "ronanleguernevel@orange.fr"; $sujet = "Message du site RLG"; $h = "From: " . $to; $message = ""; foreach($_POST as $key=>$value){ $message .= "$key : $value\n"; } if(!mail($to, $sujet, $message, $h)){$confirm=true; $comment='Message envoy�: '.$message;}else{$comment='Erreur envoi message.';} }else{$comment='Adresse email incorrecte.';} } }else{$_POST=array('message'=>'','name'=>'','email'=>'','web'=>'');} @Header("Location: http://www.ronanleguernevel.com/avenir.html") echo ''.$comment.''; if(!$confirm){ echo '