Jump to content

[SOLVED] User Registration


doddsey_65

Recommended Posts

Hi, I am trying to do a user registration script for my site. I am fine doing forms and inserting to mysql database but I have no idea how to encrypt the password submitted on the form and insert the encrypted one into mysql, also i dont know how to do a login where it would check their pass against the encrypted one. Any help or guidelines?

Link to comment
Share on other sites

Sorry, that is a bad example. To "encrypt" which you really are going to hash it, you use md5 with a unique salt.

 

The gist of it:

 

You take the password in at registration, you md5 it with a unique salt, basically just a random string unique to your script so it makes the hash a bit more secure. You have to re-use this salt on authentication.

 

For authentication, you take in the username and password on the checking page, you hash the password up with md5 and the salt, then you check it against the database. If they both check out you set a session variable saying the user is authenticated and away they go. Hopefully that gives you enough information to get started on it and post here with some code when you get stuck.

 

And on a side note, I do not know why a lot of tutorials leave out hashing the password....that is just stupid. Maybe I will make a tutorial for it :)

Link to comment
Share on other sites

here is a simple and clean example i hope you could follow

 

http://php.about.com/od/finishedphp1/ss/php_login_code.htm

 

Good luck

 

Cheers for the help guys, i think this is the only forum ive been to regardless of theme where i get  reply within a few mins. Def bookmarked this one! Anywy tht tut worked like a charm, alredy working on a myaccount are. Cheers

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.