| Current Path : /home/x/b/o/xbodynamge/namtation/reservation/dev/ |
| Current File : /home/x/b/o/xbodynamge/namtation/reservation/dev/password.php |
<?php
include_once('./inc/init.inc.php');
function new_password($nb_car, $chaine = 'azertyupqsdfghjkmwxcvbn23456789')
{
$nb_lettres = strlen($chaine) - 1;
$generation = '';
for($i=0; $i < $nb_car; $i++)
{
$pos = mt_rand(0, $nb_lettres);
$car = $chaine[$pos];
$generation .= $car;
}
return $generation;
}
$sql = "select count(*) as existe from reservation_client where email='".$_POST['email']."'";
$req = mysql_query($sql) or die('Erreur SQL !'.mysql_error());
$client = mysql_fetch_assoc($req);
if ($client['existe']==0) {
header('Location: index.php?error=2');
}
else{
$npwd=new_password(6);
$sql = "update reservation_client set mdp='".$npwd."' where email='".$_POST['email']."'";
$req = mysql_query($sql) or die('Erreur SQL !'.mysql_error());
/*mail*/
require('phpmailer/class.phpmailer.php');
$mail = new PHPMailer();
$mail->CharSet = "utf-8";
$mail->IsHTML(true);
$mail->From = "info@crosstrainingcenter.be";
$mail->FromName = "Cross Training Center";
$mail->Subject = "Votre accès au module de réservation";
$body="";
$body=$body."Bonjour,<br><br>";
$body=$body."Vous trouverez ci-dessous les paramètres qui vont permettront d'accéder au système de réservation de vos séances de CrossTraining :<br><br>";
$body=$body.'Adresse : <a href="http://reservation.crosstrainingcenter.be">http://reservation.crosstrainingcenter.be</a><br>';
$body=$body."Adresse mail : ".$_POST['email']."<br>";
$body=$body."Mot de passe : ".$npwd."<br><br>";
$body=$body."Vous pouvez à tout moment changer ce mot de passe en cliquant sur 'Mise à jour de vis données'.<br><br>";
$body=$body."Cross Training Center";
$mail->Body = $body;
$mail->AddAddress($_POST['email']);
$mail->send();
/*liam*/
header('Location: index.php?message=1');
}
mysql_close();
?>