Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <form method="POST" action="password.php">
- <table>
- <tr>
- <td>Enter your Email</td>
- <td><input type="text" size="60" name="email"></td>
- </tr>
- <tr>
- <td>Enter your UserName</td>
- <td><input type="text" size="30" name="username"></td>
- </tr>
- <tr>
- <td>Enter your new password:</td>
- <td><input type="password" size="30" name="newpassword"></td>
- </tr>
- <tr>
- <td>Re-enter your new password:</td>
- <td><input type="password" size="30" name="confirmnewpassword"></td>
- </tr>
- </table>
- <p><input type="submit" value="Update Password">
- </form>
- <?php require_once('Connections/register.php'); ?>
- <?php
- $username = $_POST['username'];
- $email = $_POST['email'];
- $password = $_POST['password'];
- $confirmnewpassword = $_POST['confirmnewpassword'];
- // Redirect links for when password reset is successful or not.
- $MM_passwordResetSuccess = "password-updated.php";
- $MM_passwordResetFailed = "reset-password.php";
- $result = mysql_query("SELECT * FROM register WHERE
- username='$username' AND email='$email'");
- if(!$result)
- {
- echo "The username or email you entered does not exist";
- }
- if($password == $confirmnewpassword)
- $sql=mysql_query("UPDATE register SET password='$password' where
- username='$username' AND email='$email'");
- if($sql)
- {
- header("Location: " . $MM_passwordResetSuccess );
- //echo "Congratulations You have successfully changed your password";
- }
- else
- {
- header("Location: ". $MM_passwordResetFailed );
- //echo "Passwords do not match";
- }
- ?>
Add Comment
Please, Sign In to add comment