Advertisement
Guest User

Untitled

a guest
Feb 2nd, 2016
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 4.36 KB | None | 0 0
  1. $headers = "Reply-To: My Site <info@example.com>rn";
  2. $headers .= "Return-Path: My Site <info@example.com>rn";
  3. $headers .= "From: My Site <info@example.com>rn";
  4. $headers .= "Organization: info@example.comrn";
  5. $headers .= "MIME-Version: 1.0rn";
  6. $headers .= "Content-type: text/html;; charset=iso-8859-1rn";
  7. $headers .= "X-Priority: 3rn";
  8. $headers .= "X-Mailer: PHP". phpversion() ."rn" ;
  9.  
  10. if(isset($_POST['sub']) && $_POST['sub']=="Submit")
  11. {
  12. $email=mysql_real_escape_string(trim($_POST['email']));
  13. $email_fetch=$con->getdata("select * from mytable where email='{$email}'");
  14. $rows=mysql_num_rows($email_fetch);
  15. if($rows==0)
  16. {
  17. echo '<script> alert("Email Id Not Registered With Us.") </script>';
  18. }
  19. else
  20. {
  21. function randomcode()
  22. {
  23. $chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijkmnopqrstuvwxyz0123456789";
  24. $i = 0;
  25. $vcode = '' ;
  26. while($i < 7)
  27. {
  28. $num = mt_rand(0,61);
  29. $tmp = substr($chars, $num, 1);
  30. $vcode = $vcode . $tmp;
  31. $i++;
  32. }
  33. return $vcode;
  34. }
  35. $msg=randomcode();
  36. $secure_msg=md5($msg);
  37. $update_pass=$con->setdata("update mytable set pass='$secure_msg' where email='{$email}'");
  38. $user_subject='Your New Password';
  39. $user_message='
  40. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  41. <html xmlns="http://www.w3.org/1999/xhtml">
  42. <head>
  43.  
  44. <meta name="viewport" content="width=device-width"/>
  45. <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
  46. <title>Example</title>
  47. <!-- <link rel="stylesheet" type="text/css" href="stylesheets/email.css"/> -->
  48. </head>
  49. <body bgcolor="#FFFFFF">
  50.  
  51. <table style="width:100%;" bgcolor="#999999">
  52. <tr>
  53. <td></td>
  54. <td>
  55. <div style="padding:15px;max-width:600px;margin:0 auto;display:block;">
  56. <table style="width:100%;" bgcolor="#999999">
  57. <tr>
  58. <td style="padding:15px;"><img src="http://www.example.com/images/logo.jpg"/></td>
  59. </tr>
  60. </table>
  61. </div>
  62. </td>
  63. <td></td>
  64. </tr>
  65. </table>
  66.  
  67. <table style="width: 100%;">
  68. <tr>
  69. <td></td>
  70. <td style="display:block!important;max-width:600px!important;margin:0 auto!important;clear:both!important;" bgcolor="#FFFFFF">
  71. <div style="padding:15px;max-width:600px;margin:0 auto;display:block;">
  72. <table style="width:100%;">
  73. <tr>
  74. <td>
  75. <h3>Dear User,</h3>
  76. <p>Your password was reset at <a style="color: #2BA6CB;" href=http://www.example.com target=_blank>www.example.com</a>
  77. </p>
  78.  
  79. <p style="padding:15px;background-color:#ECF8FF;margin-bottom: 15px;">
  80. New password is '.$msg.'
  81. </p>
  82.  
  83. <table style="background-color:#ebebeb;font-size:18px;line-height:19px;font-family: Helvetica, Arial, sans-serif; font-weight:normal;" width="100%">
  84. <tr>
  85. <td>
  86.  
  87. <table align="left" style="width: 200px;float:left;">
  88. <tr>
  89. <td style="padding-left: 10px;">
  90. <h5 class="">Connect with Us:</h5>
  91. <p class=""><a href="#" style="padding: 3px 7px;font-size:12px;margin-bottom:10px;text-decoration:none;color: #FFF;font-weight:bold;display:block;text-align:center;background-color: #3B5998!important;">Facebook</a> <a href="#" style="padding: 3px 7px;font-size:12px;margin-bottom:10px;text-decoration:none;color: #FFF;font-weight:bold;display:block;text-align:center;background-color: #1daced!important;">Twitter</a> <a href="#" style="padding: 3px 7px;font-size:12px;margin-bottom:10px;text-decoration:none;color: #FFF;font-weight:bold;display:block;text-align:center;background-color: #DB4A39!important;">Google+</a></p>
  92. </td>
  93. </tr>
  94. </table>
  95.  
  96. <table align="right" style="width: 300px;float:right;">
  97. <tr>
  98. <td>
  99. <h5 class="">Contact Info:</h5>
  100. <p>Phone: <strong>123.456.7890</strong><br/>
  101. Email: support@example.com</td>
  102. </tr>
  103. </table>
  104. </td>
  105. </tr>
  106. </table>
  107. </td>
  108. </tr>
  109. </table>
  110. </div>
  111. </td>
  112. <td></td>
  113. </tr>
  114. </table>
  115.  
  116. </body>
  117. </html>
  118. ';
  119. $mailto_user=mail($email, $user_subject, $user_message, $headers);
  120.  
  121. var_dump($mailto_user);
  122. if($mailto_user)
  123. {
  124. echo '<script> alert("A New Password Is Sent To Your Email Id") </script>';
  125. //header('location: example-signin.php');
  126. }
  127. }
  128. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement