Jump to content

Little help with php!

Lucifer

So yeah um i made myself a website which has a user log in system within that so while someone is registering i made something that gives each user a unique salt and saves values in the database.

i am able to find the username and password provided in log in form but for some reason i have unable to match the salt present in database table with the username provided from log in.

​so i was here to ask help how do i find the salt of a respective user with the username provided in log in form so that i could decry pt the password and make the user log in.





By the way thanks for the help.

Evil's Advocate Approved.

Link to comment
Share on other sites

Link to post
Share on other sites

You don't decrypt a password, you hash the input. You find the salt by reading from where you stored it in the database.

Want to solve problems? Check this out.

Link to comment
Share on other sites

Link to post
Share on other sites

You don't decrypt a password, you encrypt the input. You find the salt by reading from where you stored it on the database.

You don't encrypt the input either, you hash it (I'm sure that's what you meant just making it clear).

For a good guide on passwording check out http://alias.io/2010/01/store-passwords-safely-with-php-and-mysql/

the salt can just be stored with the password you need to get from the database anyway.

1474412270.2748842

Link to comment
Share on other sites

Link to post
Share on other sites

You don't encrypt the input either, you hash it (I'm sure that's what you meant just making it clear).

 

Yes, oops. Thanks.

Want to solve problems? Check this out.

Link to comment
Share on other sites

Link to post
Share on other sites

ummmm like yeah i know i need hash it with salt but i don't know how i select the corresponding salt of a user with his username in the database table

Evil's Advocate Approved.

Link to comment
Share on other sites

Link to post
Share on other sites

Well, you can store it on the same table you store the user data, or you can store it on a separate table. You probably have set up an unique identifier (like a user id) which you use to identify each user, simply store the salt in a table that has a foreign key to this identifier.

Want to solve problems? Check this out.

Link to comment
Share on other sites

Link to post
Share on other sites

nice idea thank you for your great help :)

Evil's Advocate Approved.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×