Advertisement
Guest User

Untitled

a guest
Mar 11th, 2016
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.90 KB | None | 0 0
  1. <?php
  2. include('./connect1.php');
  3. $username = $_GET['user'];
  4. $password = $_GET['pass'];
  5. $email = "";
  6. $sql = "SELECT email FROM users WHERE username='$username'";
  7. $result = mysqli_query($conn, $sql);
  8. if(mysqli_num_rows($result)>0){
  9. $row = mysqli_fetch_assoc($result);
  10. $email = $row['email'];
  11. }
  12. else{
  13. echo "no such user exists";
  14. }
  15. $to = $email;
  16. $from = "gopal@gmail.com";
  17. $message = "
  18. <html>
  19. <head>
  20. <title>Password Reset</title>
  21. </head>
  22. <body>
  23. <p>Please click on this link to reset your passowrd</p>
  24. <a href='www.someone.com/login/reset.php?user=".$username."'>Reset Password</a>
  25. </body>
  26. </html>
  27. ";
  28. $subject = "Password Reset";
  29. $headers = "MIME-Version: 1.0" . "rn";
  30. $headers .= "Content-type:text/html;charset=UTF-8" . "rn";
  31.  
  32. // More headers
  33. $headers .= 'From: <gopal@gmail.com>' . "rn";
  34. mail($to,$subject,$message,$headers);
  35. echo '<script>alert("Password reset mail has been sent to'.$email.'");</script>';
  36. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement