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
| <?php
else if ($_POST["submit_inscription"])
{
$nom=trim($_POST["nom"]);
$email=trim($_POST["email"]);
$restaurant=trim($_POST["restaurant"]);
$pwd=trim($_POST["pwd"]);
if ( $email=='' || $pwd=='')
{
$tab_erreur[0]="Veuillez renseignez tous les champs obligatoires !";
}
else if (isValidEmail($email)==false)
{
$tab_erreur[0]="Votre adresse email n'est pas valide !";
}
else if (strlen($pwd)<6 || strlen($pwd)>15)
{
$tab_erreur[0]="Veuillez renseigner un mot de passe comprenant entre 6 et 15 caractères !";
}
else
{
$qexists = mysql_query("SELECT COUNT(id_user) FROM users WHERE email='$email'");
$rexists = mysql_fetch_row($qexists);
if ($rexists[0]>0)
{
?>
<script type="text/javascript">
alert('Un compte a déjà été créé avec cette adresse email sur YouResto.com. En cas de perte de mot de passe, vous pouvez récupérer vos identifiants en cliquant sur le lien prévu à cet effet. Pour plus d\'informations, n\'hésitez pas à nous contacter.');
</script>
<?
}
else
{
$ip=$_SERVER['REMOTE_ADDR'];
$key=random_charac(25);
mysql_query("INSERT INTO users SET nom='$nom', pwd='$pwd', email='$email', date=NOW(), ip='$ip', restaurant='$restaurant', status='1', `key`='$key'");
$id=mysql_insert_id();
$sujet="Youresto.com - Validez votre inscription";
$sujet_admin="Nouvelle inscription";
$msg_admin='Une nouvelle inscription a eu lieu sur Youresto.com <a href="mailto:'.$email.'">'.$email.'</a> ( ip: '.$ip.' ).<br /><br />INFORMATIONS PERSONNELLES DU NOUVEAU MEMBRE:<br /><br />
<strong>Nom</strong>: '.$nom.'<br />
<strong>Nom du resto</strong>: '.$restaurant.'<br />
<strong>Email</strong>:'.$email.'<br /><br />
<strong>Cle</strong>:'.$key.'<br /><br />';
$msg="Votre demande d'inscription sur YouResto.com a bien été enregistrée. Afin de la valider, veuillez cliquer sur le lien ci-dessous, ou le copier dans la barre d'adresses de votre navigateur internet:<br /><br />
<a href=\"http://www.youresto.com/valider_inscription.php?key=".$key."\">http://www.youresto.com/valider_inscription.php?key=".$key."</a><br /><br />Vous pourrez ensuite créer la fiche de votre restaurant sur votre espace personnel.<br><br>Cordialement,<br /><br />L'equipe de YouResto.com.";
$email_admin = "postmaster@youresto.com";
$entete = "MIME-Version: 1.0\r\n";
$entete .= "Content-type: text/html; charset=iso-8859-1\r\n";
$entete .= "From: youResto@".$ip.".com\r\n";
mail("postmaster@youresto.com",$sujet_admin,$msg_admin,$entete); // email envoyé à l'admin
//mail($email_admin,$sujet_admin,$msg_admin,$entete); // email envoyé à l'admin
mail($email,$sujet,$msg,$entete);
?>
<script type="text/javascript">
alert('Votre inscription a bien été enregistrée ! Un email contenant un lien de validation vous a été envoyé afin de valider votre inscription.');
window.location='index.php';
</script>
<?
die();
}
}
} |
Partager