1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99
| <?php
if(isset($_POST['pseudo']) && isset($_POST['email']) && empty($_POST['website']) && isset($_POST['objet']) && isset($_POST['message_contact'])) {
$error = NULL;
$count_error = 0;
if(empty($_POST['pseudo'])) {
$error = $error.' \'Pseudo obligatoire\' ';
$count_error = $count_error + 1;
}
if(empty($_POST['email'])) {
$error = $error.' \'E-mail obligatoire\' ';
$count_error = $count_error + 1;
}
else {
if(!VerifierAdresseMail($_POST['email'])) {
$error = $error.' \'E-mail invalide\' ';
$count_error = $count_error + 1;
}
}
if(empty($_POST['objet'])) {
$error = $error.' \'Objet du message obligatoire\' ';
$count_error = $count_error + 1;
}
if(empty($_POST['message_contact'])) {
$error = $error.' \'Message obligatoire\' ';
$count_error = $count_error + 1;
}
if($error == NULL) {
$pseudo = htmlentities($_POST['pseudo']);
$email = htmlentities($_POST['email']);
$objet = htmlentities($_POST['objet']);
$message_contact = stripslashes(htmlentities($_POST['message_contact']));
$mail = '*****@hotmail.fr';
$headers = 'From: "'.$pseudo.'"<'.$email.'>'."\n";
$headers .= 'Content-Type: text/plain; charset="iso-8859-1"'."\n";
$headers .= 'Content-Transfer-Encoding: 8bit';
mail(''.$mail.'', ''.$objet.'', ''.$message_contact.'', ''.$headers.'');
$pseudo = NULL;
$email = NULL;
$objet = NULL;
$message_contact = NULL;
$msg_confirm = 'Votre message a bien été envoyé. Vous recevrez une réponse rapidement.';
}
else {
$pseudo = $_POST['pseudo'];
$email = $_POST['email'];
$objet = $_POST['objet'];
$message_contact = $_POST['message_contact'];
}
}
else {
$pseudo = NULL;
$email = NULL;
$objet = NULL;
$message_contact = NULL;
}
if(!empty($msg_confirm)) {
echo '
<div id="msg_confirm">
<img src="./images/information.png" alt="Information" id="msg_image" />
<p>'.$msg_confirm.'</p>
<p class="spacer"></p>
</div>';
}
if(!empty($error)) {
if($count_error == 1) {
$accord = 'erreur';
}
else {
$accord = 'erreurs';
}
echo '
<div id="msg_erreur">
<img src="./images/erreur.png" alt="Erreur" id="msg_image" />
<p>'.$count_error.' '.$accord.' : '.$error.'</p>
<p class="spacer"></p>
</div>';
}
?>
<div id="formulaire">
<form method="post" action="http://www.planetechanvre.com/nous-contacter.html">
<div id="field_bloc">
<p><label for="pseudo">Votre nom <span class="champ_obligatoire">*</span></label><input type="text" id="pseudo" name="pseudo" value="<?= $pseudo; ?>" /></p>
<p><label for="email">Votre e-mail <span class="champ_obligatoire">*</span></label><input type="text" id="email" name="email" value="<?= $email; ?>" /></p>
<p style="display:none"> <textarea name="website" rows="8" cols="35"></textarea> </p>
<p><label for="objet">L'objet du message <span class="champ_obligatoire">*</span></label><input type="text" id="objet" name="objet" value="<?= $objet; ?>" /></p>
<p><label for="message_contact">Votre message <span class="champ_obligatoire">*</span></label><textarea id="message_contact" name="message_contact" rows="" cols="" ><?= $message_contact; ?></textarea></p>
</div>
<div id="obligatoire"><span class="champ_obligatoire">*</span> Champ obligatoire</div>
<div id="submit"><input type="submit" value="Envoyer le message" /></div>
</form>
</div> |
Partager