Guest User

Untitled

a guest
Apr 21st, 2018
136
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.62 KB | None | 0 0
  1. <form method="POST" action="password.php">
  2. <table>
  3. <tr>
  4. <td>Enter your Email</td>
  5. <td><input type="text" size="60" name="email"></td>
  6. </tr>
  7. <tr>
  8. <td>Enter your UserName</td>
  9. <td><input type="text" size="30" name="username"></td>
  10. </tr>
  11. <tr>
  12. <td>Enter your new password:</td>
  13. <td><input type="password" size="30" name="newpassword"></td>
  14. </tr>
  15. <tr>
  16. <td>Re-enter your new password:</td>
  17. <td><input type="password" size="30" name="confirmnewpassword"></td>
  18. </tr>
  19. </table>
  20. <p><input type="submit" value="Update Password">
  21. </form>
  22.  
  23. <?php require_once('Connections/register.php'); ?>
  24. <?php
  25.  
  26. $username = $_POST['username'];
  27. $email = $_POST['email'];
  28. $password = $_POST['password'];
  29. $confirmnewpassword = $_POST['confirmnewpassword'];
  30.  
  31. // Redirect links for when password reset is successful or not.
  32. $MM_passwordResetSuccess = "password-updated.php";
  33. $MM_passwordResetFailed = "reset-password.php";
  34.  
  35.  
  36. $result = mysql_query("SELECT * FROM register WHERE
  37. username='$username' AND email='$email'");
  38. if(!$result)
  39. {
  40. echo "The username or email you entered does not exist";
  41. }
  42.  
  43. if($password == $confirmnewpassword)
  44. $sql=mysql_query("UPDATE register SET password='$password' where
  45.  
  46. username='$username' AND email='$email'");
  47. if($sql)
  48. {
  49. header("Location: " . $MM_passwordResetSuccess );
  50. //echo "Congratulations You have successfully changed your password";
  51. }
  52. else
  53. {
  54. header("Location: ". $MM_passwordResetFailed );
  55. //echo "Passwords do not match";
  56. }
  57. ?>
Add Comment
Please, Sign In to add comment