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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:19:30+00:00 2026-06-16T00:19:30+00:00

I am currently working on a school project and I have recently made no

  • 0

I am currently working on a school project and I have recently made no progress towards completing the login authorization. I am using a HASH and a SALT to register the new users. I can not find any resources that make seance to me so I decided to make an account here to ask my very own question.

This is my register script :

    $username = $_POST['username'];
    $email = $_POST['email'];
    $first = $_POST['fname'];
    $last = $_POST['lname'];
    $salt = crypt("sha512", false);
    $pass = $_POST['password'];
    $password = hash("sha512", $salt . $pass . $salt, false);

$sql = "INSERT INTO `users` (`username`, `email`, `fname`, `lname`, `salt`, `password`) VALUES ('$username', '$email', '$first', '$last', '$salt', '$password')";

Then I have a checklogin.php script that is the action=”checklogin.php” on my index page which is the login page. This is the full script : http://pastebin.com/tKrsHaFU (paste bin)

My question is how do I validate my users that come to index.php page (login form) with the the users that are already in the database keep in mind I have a salt and Hash on the passwords.

  • 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-16T00:19:31+00:00Added an answer on June 16, 2026 at 12:19 am

    First of all:

    $salt = crypt("sha512", false);
    

    That generates a static salt, i.e. no variation. To generate a better one:

    $salt = uniqid(mt_rand(), true); // the paranoid use openssl_random_pseudo_bytes()
    

    To validate the record, your SQL becomes:

    $sql="SELECT * FROM $tbl_name WHERE username='$myusername'";
    $result=mysql_query($sql);
    // ...
    if ($count==1) {
        $row = mysql_fetch_assoc($result);
        if (hash('sha512', $row['salt'] . $_POST['mypassword'] . $row['salt']) == $row['password']) {
            // validation passed, rejoice!
        }
    }
    

    However, you should look here: How do you use bcrypt for hashing passwords in PHP?

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

Sidebar

Related Questions

I'm currently working on a school project in Eclipse (We have just started using
I'm currently working on a school (matrix multiplier) project and I have a problem.
I am currently working on a school project and I'm not sure what is
I'm currently working on some school project; we are developing a simple RPG, but
I am currently working on a school project and missed a class where the
I am currently working on a school project where the assignment, among other things,
I am currently working on a project for school, it is Java based and
Two part question: I'm working on a school project using the game of life
I'm working on a school project where we have to create a virtual smartphone,
I wrote a couple functions for a school project, and I have them working

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.