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
|
<?php
// Couleur du texte des champs si erreur saisie utilisateur
$color_font_warn="#FF0000";
// Couleur de fond des champs si erreur saisie utilisateur
$color_form_warn="#FFCC66";
// Ne rien modifier ci-dessous si vous nêtes pas certain de ce que vous faites !
if(isset($_POST['submit'])){
$erreur="";
// Nettoyage des entrées
while(list($var,$val)=each($_POST)){
if(!is_array($val)){
$$var=strip_tags($val);
}else{
while(list($arvar,$arval)=each($val)){
$$var[$arvar]=strip_tags($arval);
}
}
}
// Formatage des entrées
$f_1=trim(ucwords(eregi_replace("[^a-zA-Z0-9éèàäö\ -]", "", $f_1)));
$f_2=strip_tags(trim($f_2));
// Verification des champs
if(strlen($f_1)<2){
$erreur.="<li><span class='txterror'>Le champ « Votre IMEI » est vide ou incomplet.</span>";
$errf_1=1;
}
if(strlen($f_2)<2){
$erreur.="<li><span class='txterror'>Le champ « Votre e-mail » est vide ou incomplet.</span>";
$errf_2=1;
}else{
if(!ereg('^[-!#$%&\'*+\./0-9=?A-Z^_`a-z{|}~]+'.
'@'.
'[-!#$%&\'*+\/0-9=?A-Z^_`a-z{|}~]+\.'.
'[-!#$%&\'*+\./0-9=?A-Z^_`a-z{|}~]+$',
$f_2)){
$erreur.="<li><span class='txterror'>La syntaxe de votre adresse e-mail n'est pas correcte.</span>";
$errf_2=1;
}
}
if($erreur==""){
// Création du message
$titre="Message de votre site";
$tete="From:Site@monsite.fr\n";
$corps.="Votre IMEI : ".$f_1."\n";
$corps.="Votre e-mail : ".$f_2."\n";
if(mail("moi@gmail.com", $titre, stripslashes($corps), $tete)){
$ok_mail="true";
}else{
$erreur.="<li><span class='txterror'>Une erreur est survenue lors de l'envoi du message, veuillez refaire une tentative.</span>";
}
}
}
?><html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css" media="screen"><!--
INPUT { color: #000; font-size: 11px; font-family: verdana, Arial, Helvetica, Geneva, Swiss, SunSans-Regular; background-color: #EEEEEE }
SELECT { color: #000; font-size: 11px; font-family: verdana, Arial, Helvetica, Geneva, Swiss, SunSans-Regular; background-color: #EEEEEE }
TEXTAREA { color: #000; font-size: 11px; font-family: verdana, Arial, Helvetica, Geneva, Swiss, SunSans-Regular; background-color: #EEEEEE }
.txterror { color: white; font-size: 11px; font-family: Verdana, Arial, Helvetica, Geneva, Swiss, SunSans-Regular }
.txtform { color: white; font-size: 24px; font-family: Verdana, Arial, Helvetica, Geneva, Swiss, SunSans-Regular }
.style3 {
color: white;
font-size: small;
font-family: "Open Sans"
}
.style4 {
background-color: #0088CB;
}
.style5 {
color: white;
font-size: x-large;
font-family: "Open Sans"
}
.style7 {
color: black;
font-size: x-large;
font-family: "Open Sans"
}
.style8 {
text-align: left;
}
.style9 {
color: white;
font-size: x-large;
font-family: "Open Sans"
-->}
.style10 {
color: white;
font-size: small;
font-family: Verdana, Arial, Helvetica, Geneva, Swiss, SunSans-Regular;
}
.style11 {
color: black;
}
</style></head>
<body>
<? if($ok_mail=="true"){ ?>
<tr><td><span class='txtform'>Nous avons bien reçu votre demande.</span></td></tr>
<tr><td> </td></tr>
<tr><td><tt><?echo nl2br(stripslashes($corps));?></tt></td></tr>
<tr><td> </td></tr>
<tr><td><span class='txtform'>Nous allons y donner suite dans les meilleurs délais.<br></span></td></tr>
</table>
<? }else{ ?>
<form action='<? echo $PHP_SELF ?>' method='post' name='Form'>
<table width='100%' border='0' cellspacing='1' cellpadding='1'>
<? if($erreur){ ?><tr><td colspan='2' class="style4"><font color='white'>
<span class='style10'> </span><span class='style3'>ERREUR, votre demande n'a pas été
transmise</span></font></td></tr><tr><td colspan='2'><ul><?echo$erreur?></ul></td></tr><?}?>
<tr><td align='right' width='30%'><span class='style7'>numéro </span><span class='txtform'>
</span></td><td>
<input type='text' class="style7" style='width:400px; height: 50px; color: #333333;' name='f_1' value='<?echo stripslashes($f_1);?>' size='50' border='0'></td></tr>
<tr><td align='right' width='30%' class="style5"><span class="style11">Votre adresse e-mail</span>l </td><td>
<input type='text' class="style7" style='width:400px; height: 50px; color: #333333;' name='f_2' value='<?echo stripslashes($f_2);?>' size='50' border='0'></td></tr>
<tr><td align='right' width='30%'></td><td class="style8">
<input type='submit' class="style9" name='submit' value='envoyer !' border='0' style="width: 153px; height: 47px; background-color: #00FF00;"></td></tr>
</table>
</form>
<? } ?></body>
</html> |
Partager