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
| <?php
define('FICHIER_INI', 'gatel.ini');
include "lib_objet.inc.php";
$_INI = new fichierini(FICHIER_INI);
$_BDD = $_INI->load_cate("BDD");
function EmailOK($email){
return( ereg('^[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+'.'@'.'[-!#$%&\'*+\\/0-9=?A-Z^_`a-z{|}~]+\.'.'[-!#$%&\'*+\\./0-9=?A-Z^_`a-z{|}~]+$',$email) );
}
function valide_frm_info($POST){
$msg = "";
if (!EmailOK($POST["mail"])==TRUE || empty($POST["mail"]) || ( substr_count($POST["mail"]," ")==strlen($POST["mail"])))
$msg = "Votre email est incorrect.<BR>";
if (empty($POST["message"]) || ( substr_count($POST["message"]," ")==strlen($POST["message"])))
$msg .= "Votre message est incorrect.<BR>";
return $msg;
}
function valide_frm_nl($POST){
$msg = "";
if (!EmailOK($POST["mail"])==TRUE || empty($POST["mail"]) || ( substr_count($POST["mail"]," ")==strlen($POST["mail"])) )
$msg = "Votre email est incorrect.<BR>";
return $msg;
}
if (sizeof($HTTP_GET_VARS) > 0){
$ligne = $HTTP_GET_VARS;
if ($_GET["nl"]=="YES")
$msg = valide_frm_nl($ligne);
else
$msg = valide_frm_info($ligne);
if (empty($msg) && $_GET["message"]){
$mes = str_replace("+", " ", $_GET["message"]);
$_message = "<HTML><BODY><A><B>Email : </B>".$_GET["mail"]."<BR><B>Nom : </B>".$_GET["nom"]."<BR><B>Prénom : </B>".$_GET["prenom"]."<BR><BR><B>Message : </B><BR><BR>".nl2br($mes)."</A></BODY></HTML>";
$header = "From: Formulaire de contact<".$_GET["mail"].">\r\n";
$header.= "X-Sender: ".$_GET["mail"]."\n";
$header.= "X-Mailer: had0mail\n";
$header.= "Return-Path: <".$_GET["mail"].">\n";
$header.= "Content-Type: text/html; charset=iso-8859-1\n";
mail("xxx@gmail.com", "Message envoyé depuis le site www.xxx.com", $_message, $header);
$msg = "Votre message a été envoyé avec succès.<BR>";
}
if (empty($msg) && $_GET["nl"]=="YES"){
$sql = " INSERT INTO TABLE (mail, nom, prenom)
VALUES ('".$_GET["mail"]."', '".$_GET["nom"]."', '".$_GET["prenom"]."');";
//new query($_BDD, $sql);
$msg .= "Votre inscription à la newsletter a été enregistrée avec succès.<BR>";
}
}
?>
<HTML>
<HEAD>
<META http-equiv="content-type" content="text/html;charset=ISO-8859-1">
<TITLE>xxx</TITLE>
<SCRIPT LANGUAGE="javascript">
self.resizeTo(500,500);
</SCRIPT>
</HEAD>
<BODY text="#000000" link="#006699" vlink="#006699" alink="#006699" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<TABLE width="100%" height="100%">
<TR>
<TD align="center">
<A href="javascript:window.close()"><IMG src="gatel_logo.jpg" border="0"></A><BR>
<font size="-3" face="Verdana, Arial, Helvetica, sans-serif">
<B><A><?=$msg;?></A></B><BR>
<A href="javascript:window.close()">Retour</A><BR>
</font>
</TD>
</TR>
</TABLE>
</BODY>
</HTML> |
Partager