Advertisement
Guest User

Untitled

a guest
Apr 19th, 2015
243
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.59 KB | None | 0 0
  1. <?php
  2.     $email = $_POST['email'];
  3.     $newpassword = hash('sha256',($_POST['newpassword']));
  4.     $cnewpassword = hash('sha256',($_POST['cnewpassword']));
  5.     $generatedKey = hash('sha256',(mt_rand(10000,99999).time().$email));
  6.    
  7.     $sqlUpdate = ("UPDATE tbuser SET userPwd = '$newpassword'
  8.                                WHERE userMail = '$email' ");
  9.     $sqlUpdate2 = ("UPDATE tbuser SET userGeneratedKey = '$generatedKey'
  10.                                WHERE userMail = '$email' ");
  11.     $sqlUpdate3 = ("UPDATE tbuser SET userStatus = 'Activation'
  12.                                WHERE userMail = '$email' ");
  13.  
  14.     if (mysqli_query($db_connexion, $sqlUpdate)) {
  15.         if(mysqli_query($db_connexion, $sqlUpdate2)){
  16.             echo"| activation key sent to '$email'. |";
  17.         }
  18.         if(mysqli_query($db_connexion, $sqlUpdate3)){
  19.             echo"| status updated\n. |";
  20.         }
  21.         echo "| Password updated, please activate account!.|";
  22.         $source = "Admin";
  23.         $message      = "Password updated, please activate account!";
  24.         $sujet        = "CHANGING PASSWORD ON HE201137";
  25.         $msg          = "Password updated, please activate account!;
  26.            Message: $message \n;
  27.            Clé d'activation: http://193.190.65.94/he201137/ESSAIS/activation.php?generatedKey=$generatedKey";
  28.         $entete       = "From: $source \n Reply-To: $email";
  29.         $sujetCopie   = "(Copie) Inscription sur le site";
  30.    
  31.         mail($email, $sujet, $msg, $entete);
  32.     } else {
  33.         echo "Error: " . $sqlUpdate . "<br>" . mysqli_error($db_connexion);
  34.     }
  35. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement