se dont je voudrait c'est vérifier tout les champs et informer l'internaute si il y a une erreur ou champs vides
Code : Tout sélectionner
<form action="mailer.php" method="post">
<div class="form-group wow fadeInDown" data-wow-duration="500ms" data-wow-delay="600ms">
<input type="text" class="form-control" name="name" placeholder="Nom..." value="<?php echo $_GET['name'];?>"/>
<div class="form-group wow fadeInDown" data-wow-duration="500ms" data-wow-delay="600ms">
<input type="text" class="form-control" name="from" placeholder="Mail..." value="<?php echo $_GET['from'];?>"/>
<div class="form-group wow fadeInDown" data-wow-duration="500ms" data-wow-delay="600ms">
<input type="text" class="form-control" name="subject" placeholder="Sujet..." value="<?php echo $_GET['subject'];?>"/>
Anti-spam:<br />
<input name="verif_box" type="text"/>
<img src="verificationimage.php?<?php echo rand(0,9999);?>" alt="verification" width="50" height="24" align="absbottom" /><br />
<br />
<?php if(isset($_GET['wrong_code'])){?>
<div>Mauvais code</div><br />
<?php ;}?>
<div class="form-group wow fadeInDown" data-wow-duration="500ms" data-wow-delay="1000ms">
<textarea class="form-control" name="message" rows="3" placeholder="Message..."><?php echo $_GET['message'];?></textarea>
<p><input name="Submit" type="submit" value="Envoyer"/></p>
<input type="hidden" name="good_url" value="http://webcreationagence.com/merci.html">
</form>Code : Tout sélectionner
<?php
$name = $_REQUEST["name"];
$subject = $_REQUEST["subject"];
$message = $_REQUEST["message"];
$from = $_REQUEST["from"];
$verif_box = $_REQUEST["verif_box"];
$name = stripslashes($name);
$message = stripslashes($message);
$subject = stripslashes($subject);
$from = stripslashes($from);
if(md5($verif_box).'a4xn' == $_COOKIE['tntcon']){
$message = "Nom: ".$name."\n".$message;
$message = "De: ".$from."\n".$message;
mail("*****@hotmail.com", 'Message: '.$subject, $_SERVER['REMOTE_ADDR']."\n\n".$message, "From: $from");
header("Location: redirect.html");
setcookie('tntcon','');
} else {
header("Location:".$_SERVER['HTTP_REFERER']."?subject=$subject&from=$from&message=$message&wrong_code=true");
header("Location: google.com");
}
?>
verificationimage.php
Code : Tout sélectionner
<?php
header('Content-type: image/jpeg');
$width = 50;
$height = 24;
$my_image = imagecreatetruecolor($width, $height);
imagefill($my_image, 0, 0, 0xFFFFFF);
for ($c = 0; $c < 40; $c++){
$x = rand(0,$width-1);
$y = rand(0,$height-1);
imagesetpixel($my_image, $x, $y, 0x000000);
}
$x = rand(1,10);
$y = rand(1,10);
$rand_string = rand(1000,9999);
imagestring($my_image, 5, $x, $y, $rand_string, 0x000000);
setcookie('tntcon',(md5($rand_string).'a4xn'));
imagejpeg($my_image);
imagedestroy($my_image);
?>
merci