Advertisement
Guest User

Untitled

a guest
Aug 12th, 2017
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.21 KB | None | 0 0
  1. <?
  2.  
  3. require_once ('mysql_db.php');
  4.  
  5. // value sent from form
  6. $email_to=$_POST['email_to'];
  7.  
  8. // table name
  9. $tbl_name = '';
  10.  
  11. $sql="SELECT passwd FROM $tbl_name WHERE email='$email_to'";
  12. $result=mysql_query($sql);
  13.  
  14. // if found this e-mail address, row must be 1 row
  15. // keep value in variable name "$count"
  16. $count=mysql_num_rows($result);
  17.  
  18. // compare if $count =1 row
  19. if($count==1){
  20.  
  21. $rows=mysql_fetch_array($result);
  22.  
  23. // keep password in $your_password
  24. $your_password=$rows['passwd'];
  25. // ---------------- SEND MAIL FORM ----------------
  26.  
  27. // send e-mail to ...
  28. $to=$email_to;
  29.  
  30. // Your subject
  31. $subject="Your password here";
  32.  
  33. // From
  34. $header="from: ";
  35.  
  36. // Your message
  37. $messages= "kljkljkljklljk \r\n";
  38. $messages.="jlkjkljlk - $your_password \r\n";
  39. $messages.="jkjljkljll. \r\n";
  40.  
  41. // send email
  42. $sentmail = mail($to,$subject,$messages,$header);
  43.  
  44. }
  45.  
  46. // else if $count not equal 1
  47. else {
  48. echo "Not found your email in our database";
  49. }
  50.  
  51. // if your email succesfully sent
  52. if($sentmail){
  53. echo "Your Password Has Been Sent To Your Email Address.";
  54. echo "<meta http-equiv='REFRESH' content='3;url=index.php'>";
  55. }
  56. else {
  57. echo "Cannot send password to your e-mail address";
  58. }
  59.  
  60. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement