SHARE
TWEET

Untitled

a guest Oct 4th, 2017 55 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. <?php include "connection.php";
  2.  
  3.  if(isset($_POST) & !empty($_POST)){
  4. //print_r($_POST); die;
  5.    $username = mysqli_real_escape_string($conn, $_POST['username']);
  6.    $sql = "SELECT * FROM `users` WHERE username = '$username'";
  7.    $res = mysqli_query($conn, $sql);
  8.    $count = mysqli_num_rows($res);
  9.    if($count == 1){
  10.     echo "Send email to user with password";
  11.    }else{
  12.         echo "User name does not exist in database";
  13.     }
  14.  
  15.    $r = mysqli_fetch_assoc($res);
  16.      $password = $r['password'];
  17.    $to = $r['username'];
  18.     $subject = "Your Recovered Password";
  19.  
  20.    $message = "Please use this password to login " . $password;
  21.        $headers = "From :abc23@gmail.com";
  22.       if(mail($to, $subject, $message, $headers)){
  23.         echo "Your Password has been sent to your email id";
  24.        }else{
  25.        echo "Failed to Recover your password, try again";
  26.  
  27.          }
  28.  
  29.         }
  30.  
  31.  
  32.      ?>
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top