Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3852028
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T17:15:15+00:00 2026-05-19T17:15:15+00:00

I have simple reset password structure for users to update their existing passwords if

  • 0

I have simple reset password structure for users to update their existing passwords if lost. The user goes to a link where they enter their email, a token is created and stored in a designated table for the user with the forgotten password. A email is sent to the user with a link that has the token attached, when they hit that link it takes them to a page to reset their password. If the token stored in the db matches the one in the $_GET, I allow them to reset their password. simple.

The problem is I can’t update their specific row in the db. I am trying to identify them by checking their email they entered against their email in the db. I am able to update the WHOLE tables password row, but when specify one user it fails.

if(isset($_POST['sub_settings'])){

    $query = "SELECT * FROM `Password_Reset` WHERE `token` = '".$token."' AND `email` = '".$user_email."'";
    $request = mysql_query($query,$connection) or die(mysql_error());
    $result = mysql_fetch_array($request);

    $token = $result['token'];
    $alpha = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcedfghijklmnopqrstuvwxyz1234567890";
    $rand = str_shuffle($alpha);
    $salt = substr($rand,0,40);
    $hashed_password = sha1($salt . $_POST['password']);
    $user_email = $result['email'];



    if($_GET['token'] == $token) {
        header("Location: index.php");
        exit;

    }else{

    if(empty($_POST['Password'])) {
        $valid = false;
        $error_msgs[] = 'Whoops! You must enter a password.';
    }

    if($_POST['Password'] != $_POST['passwordConfirm'] || empty($_POST['Password'])) {
        $valid = false;
        $error_msgs[] = "Your password entries didn't match...was there a typo?";
    }

    if($valid) {
        $query = "UPDATE `Users` SET `encrypted_password` = '$hashed_password' WHERE `Email` = '$user_email'";

        mysql_query($query,$connection);
    }


    }
}

Thanks so much in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T17:15:16+00:00Added an answer on May 19, 2026 at 5:15 pm

    It looks like you’ve not capitalized $_POST[‘Password’]

    $hashed_password = sha1($salt . $_POST['password']);
    

    Based on your other code, it should be:

    $hashed_password = sha1($salt . $_POST['Password']);
    

    Also in your SELECT, you have email and in your UPDATE you use Email. MySQL is case-sensitive by default on non-windows platforms.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a simple password reset form that has a username field, and below
I have a simple db.Model , that has one of the fields db.ListProperty(users.User) For
I am trying to run a simple password validator. I have already written it
I want to generate a password reset token for a User model that I
I have a very simple JavaFX Controller with a simple Username, Password and Logon
Suppose I have two collections/schemas. One is the Users Schema with username and password
we have a simple REST request that I can use manually on my Mac
I have a simple REST service endpoint that is failing when I POST using
I have deployed a simple REST based application in RAD. A simple URL is
I have built a pretty simple REST service in Sinatra, on Rack. It's backed

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.