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 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130
| <?php
/* Récupération des informations du formulaire*/
if (get_magic_quotes_gpc())
{
$nom = stripslashes(trim($_POST['nom']));
$prenom = stripslashes(trim($_POST['prenom']));
$dossier = stripslashes(trim($_POST['dossier']));
$societe = stripslashes(trim($_POST['societe']));
$rcs = stripslashes(trim($_POST['rcs']));
$code = stripslashes(trim($_POST['code']));
$ville = stripslashes(trim($_POST['ville']));
$telephone = stripslashes(trim($_POST['telephone']));
$fax = stripslashes(trim($_POST['fax']));
$mail = stripslashes(trim($_POST['mail']));
$motif = stripslashes(trim($_POST['motif']));
$message = stripslashes(trim($_POST['message']));
}
else
{
$nom = trim($_POST['nom']);
$prenom = trim($_POST['prenom']);
$dossier = trim($_POST['dossier']);
$societe = trim($_POST['societe']);
$rcs = trim($_POST['rcs']);
$adresse = trim($_POST['adresse']);
$code = trim($_POST['code']);
$ville = trim($_POST['ville']);
$telephone = trim($_POST['telephone']);
$fax = trim($_POST['fax']);
$mail = trim($_POST['mail']);
$motif = trim($_POST['motif']);
$message = trim($_POST['message']);
}
/*Vérifie si l'adresse mail est au bon format */
$regex_mail = '/^[-+.\w]{1,64}@[-.\w]{1,64}\.[-.\w]{2,6}$/i';
/*Verifie qu il n y est pas d en tête dans les données*/
$regex_head = '/[\n\r]/';
/*Vérifie qu il n y est pas d erreur dans adresse mail*/
if (!preg_match($regex_mail, $mail))
{
$alert = 'L\'adresse '.$mail.' n\'est pas valide';
}
else
{
$courriel = 1;
}
/* On affiche l'erreur s'il y en a une */
if (!empty($alert))
{
$courriel = 0;
}
/* On vérifie qu'il n'y a aucun header dans les champs */
if (preg_match($regex_head, $nom)
|| preg_match($regex_head, $prenom)
|| preg_match($regex_head, $dossier)
|| preg_match($regex_head, $societe)
|| preg_match($regex_head, $rcs)
|| preg_match($regex_head, $adresse)
|| preg_match($regex_head, $code)
|| preg_match($regex_head, $ville)
|| preg_match($regex_head, $telephone)
|| preg_match($regex_head, $fax)
|| preg_match($regex_head, $mail)
|| preg_match($regex_head, $motif)
|| preg_match($regex_head, $message))
{
$alert = 'En-têtes interdites dans les champs du formulaire';
}
else
{
$header = 1;
}
/* On affiche l'erreur s'il y en a une */
if (!empty($alert))
{
$header = 0;
}
if (empty($telephone)
|| empty($nom)
|| empty($message))
{
$alert = 'Tous les champs doivent être renseignés';
}
else
{
$renseigne = 1;
}
/* On affiche l'erreur s'il y en a une */
if (!empty($alert))
{
$renseigne = 0;
}
/* Si les variables sont bonne */
if ($renseigne == 1 AND $header == 1 AND $courriel == 1)
{
/*Envoi du mail*/
/*Le destinataire*/
$to=" <a href="mailto:demo@fafa-informatique.comCet">demo@fafa-informatique.comCet</a>te adresse email est protégée contre les robots des spammeurs, vous devez activer Javascript pour la voir. ";
/*Le sujet du message qui apparaitra*/
$sujet="Message depuis le site";
$msg = '';
/*Le message en lui même*/
/*$msg = 'Mail envoye depuis le site' "\r\n\r\n";*/
$msg .= 'Nom : '.$nom."\r\n\r\n";
$msg .= 'Prenom : '.$prenom."\r\n\r\n";
$msg .= 'Dossier : '.$dossier."\r\n\r\n";
$msg .= 'Societe : '.$societe."\r\n\r\n";
$msg .= 'RCS : '.$rcs."\r\n\r\n";
$msg .= 'Adresse : '.$adresse."\r\n\r\n";
$msg .= 'Code : '.$code."\r\n\r\n";
$msg .= 'Ville : '.$ville."\r\n\r\n";
$msg .= 'Telephone : '.$telephone."\r\n\r\n";
$msg .= 'Fax : '.$fax."\r\n\r\n";
$msg .= 'Mail : '.$mail."\r\n\r\n";
$msg .= 'Motif : '.$motif."\r\n\r\n";
$msg .= 'Message : '.$message."\r\n\r\n";
/*Les en-têtes du mail*/
$headers = 'From: MESSAGE DU SITE FAFA<demo@fafa-informatique>'."\r\n";
$headers .= "\r\n";
/*L'envoi du mail - Et page de redirection*/
mail($to, $sujet, $msg, $headers);
header('Location:<a href="http://www.fafa-informatique.com');" target="_blank">http://www.fafa-informatique.com');</a>
}
else
{
header('Location:<a href="http://www.fafa-informatique.com');" target="_blank">http://www.fafa-informatique.com');</a>
}
?> |
Partager