doddsey_65 Posted November 17, 2009 Share Posted November 17, 2009 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? Quote Link to comment https://forums.phpfreaks.com/topic/181918-solved-user-registration/ Share on other sites More sharing options...
premiso Posted November 17, 2009 Share Posted November 17, 2009 http://www.phpeasystep.com/phptu/6.html Plenty of tutorials online to get you started. Googled "php login tutorial" to find the above tutorial, many others out there as well. Quote Link to comment https://forums.phpfreaks.com/topic/181918-solved-user-registration/#findComment-959511 Share on other sites More sharing options...
doddsey_65 Posted November 17, 2009 Author Share Posted November 17, 2009 i read through that one and i doesnt seem to provide any clear help on this, yes it tells me how to do the login to cross check encrypted passwords but doesnt tell me how to send it to the db and encrypt it Quote Link to comment https://forums.phpfreaks.com/topic/181918-solved-user-registration/#findComment-959515 Share on other sites More sharing options...
mraza Posted November 17, 2009 Share Posted November 17, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/181918-solved-user-registration/#findComment-959518 Share on other sites More sharing options...
premiso Posted November 17, 2009 Share Posted November 17, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/181918-solved-user-registration/#findComment-959523 Share on other sites More sharing options...
doddsey_65 Posted November 18, 2009 Author Share Posted November 18, 2009 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 Quote Link to comment https://forums.phpfreaks.com/topic/181918-solved-user-registration/#findComment-960012 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.