Advertisement
Guest User

Untitled

a guest
Jul 30th, 2017
87
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.17 KB | None | 0 0
  1. Notice: Array to string conversion in C:wampwwwmyphpfilereset_pass_form.php on line <i>33</i>
  2.  
  3. An email has been sent for you to reset your password!
  4.  
  5. if ( !empty($_POST) && !empty($_POST['forgot_emailpass']) ) {
  6.  
  7. $email = escape_data($_POST['forgot_emailpass']);
  8.  
  9. $result = $heidisql->prepare("SELECT * FROM users WHERE email_address='$email'");
  10. $result->execute();
  11.  
  12. $user = $result->fetch();
  13.  
  14. If($user) {
  15.  
  16. session_start();
  17.  
  18. $reset_token = random_str(30);
  19. $new_hashtoken = bin2hex($reset_token);
  20.  
  21. $sql = "UPDATE users "
  22. . "SET reset_token= '$new_hashtoken', "
  23. . "reset_allocated_time= now() "
  24. . "WHERE user_id='$user' "; // <- Error is here!
  25.  
  26. $reset_pass = $heidisql->prepare($sql);
  27.  
  28. $reset_pass->execute();
  29.  
  30. // Send registration confirmation link (reset.php)
  31. $to= $email;
  32. $from = "smtp.intnet.mu";
  33. $subject = 'Reset Password';
  34.  
  35. //Compose a simple HTML email msg
  36. $message = "<html><body>";
  37. $message .= "<h1 style='color: darkblue;'> Hi, there you</h1>";
  38. $message .= "<p><b>Email:</b> $email</p>";
  39. $message .= "<p>To reset your password, please click on the given link below: </p>";
  40. $message .= "<a href='http://localhost:8080/myphpfile/reset_pass_form.php?user_id=".$user['user_id']."&reset_token=".$new_hashtoken. " '> Click Here</a>"; //http://localhost:8080/myphpfile/reset_pass_form.php?
  41. $message .= "</body></html>";
  42.  
  43. $headers = 'From:' .$from. "rn" . // Creating the email headers // To send an HTML mail, content-type must be set to HTML
  44. 'Reply-To: '.$from. "rn" .
  45. 'MIME-Version: 1.0' . "rn" .
  46. 'Content-type: text/html; charset=iso-8859-1' . "rn" .
  47. 'X-Mailer: PHP/' . phpversion();
  48.  
  49. if (mail($to, $subject, $message, $headers)) { // Sending email // email_to, subject, body,email_from
  50.  
  51. echo 'An email has been sent for you to reset your password!'; // As you can see above the email is being sent
  52. exit();
  53.  
  54. } else {
  55.  
  56. echo'Server failed to sent message, please try again later.';
  57. exit();
  58.  
  59. }
  60.  
  61. }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement