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
| <?php
require_once 'include/connect.php';
$email = filter_input(INPUT_POST, 'email', FILTER_VALIDATE_EMAIL);
$envoi = filter_input(INPUT_POST, 'envoi');
if ($envoi !== 'ok') {
// redirection vers la sortie
header('location:......');
exit;
}
if ($email) {
// vérification de l'existence de l'email dans la base de données
$sql = "SELECT COUNT(id) FROM users WHERE email = '$email'";
$qry = mysql_query($sql);
$nb = mysql_result($qry, 0, 0);
if ($nb == 0) {
// pas d'email trouvé : redirection vers la sortie
header('location:......');
exit;
}
}
// TOUT EST OK -> MISE À JOUR DU MOT DE PASSE
$sql = "UPDATE users SET token_password = '".sha1(uniqid(rand()))."' where email = '$email'";
$qry = mysql_query($sql);
/* ... la suite de traitement ... */
?> |