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 9242419
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T08:34:36+00:00 2026-06-18T08:34:36+00:00

I am creating a login system. But for whatever reason I can’t get the

  • 0

I am creating a login system. But for whatever reason I can’t get the password to validate properly. It keeps telling me the password is wrong when I know the password is correct. Here is the form code:

<form id="login" action="login_processing.php" method="post">
    <label2>Email</label2>
    <input type="text" name="email">
    <label2>Password</label2>
    <input type="password" name="password">
    <a class="forgot_password" href="forgot.php">Forgot password?</a>
    <input type="submit" class="custom_submit" name="sign_in" value="Sign In">
    <br />
    <br />
    <br />
    <a href="#sliderName" class="next">Create Account</a>
</form>

Here the code for processing the login information on login_processing.php:

require_once 'database_connect.php';
session_start();

$email = $_POST['email'];
$password = $_POST['password'];

$email = mysql_real_escape_string($email);
$findLogin = "SELECT password, salt FROM client_login WHERE email = '$email';";
$loginResult = mysql_query($findLogin);
if (mysql_num_rows($loginResult) < 1){
    $_SESSION['errNo_account'] = 'No account with that email exists';
    header('Location: login.php');
}
$userData = mysql_fetch_array($loginResult, MYSQL_ASSOC);
$hash = hash('sha256', $userData['salt'] . hash('sha256', $password));
if ($hash != $userData['password']){
    $_SESSION['errPassword_incorrect'] = 'Incorrect Password';
    header('Location: myaccount.php');
}
else{
    $idSelect = "SELECT client_id FROM client_login WHERE email = '$email' ";
    $idResult = mysql_query($idSelect);
    while($idData = mysql_fetch_assoc($idResult)){
        $_SESSION['client_id'] = $idData['client_id'];
    }

}

Here is the original registration page hashing the password and adding salt:

function createSalt(){
        $string = md5(uniqid(rand(), true));
        return substr($string, 0, 3);
    }
        $salt = createSalt();
        $hash = hash('sha256', $salt . $hash);  

    $insertLogin = "INSERT INTO client_login(email, password, salt, created) VALUES('$email','$hash', '$salt', '$today')";
    mysql_query($insertLogin);

It keeps telling me that my password is incorrect… when I KNOW its not. I can’t seem to figure out what the error is and ITS DRIVING ME NUTS!!!

Any help would be greatly appreciative.

  • 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-06-18T08:34:37+00:00Added an answer on June 18, 2026 at 8:34 am

    in your registration script, you are using a single hash of the concated salt and pw, but in your login script you are using nested hash() calls.

    registration:

    $hash = hash('sha256', $salt . $hash);

    login:

    $hash = hash('sha256', $userData['salt'] . hash('sha256', $password));

    notice the difference?

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

Sidebar

Related Questions

What is the best approach for creating a password-less login system? I'm thinking to
I am creating a session for a login logout system. But my session_destroy isn't
I am creating a login system for my own website so I can update
I have just finished creating an entire login and register systsem in PHP, but
I am creating a login system for a web application using PHP. My question
I'm creating a login for a website using PHP but when I try to
I was creating a login system with PHP and I wondered: Why are sessions
I'm creating a user system for Rails, and login, sign up etc... all works.
I am creating a custom CMS and have built a login system and was
I'm trying to create a login system in Rails 3 where I can access

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.