Does this registration security procedure for my website make any sense?
May 30, 2012 8:57 AM Subscribe
Does this registration security procedure for my website make any sense?
I know there are hundreds of web pages out there with information about security but its quite intimidating for someone like myself who hasn't ever had to do this before. So i'm taking it to the hive.
I've got a website with a registration form. User fills out the form, chooses a username and password, presses submit and my php page makes sure the form is all good and sends it onto the DB.
From that point, I want to send an email to the user with a URL that he must click on to activate the account. I want this URL to be unhackable and unguess-able. I started reading into checksums and MD5 and think this possibly sounds like the way to go. Heres my solution.. would appreciate if you professionals out there can critique it and tell me if i'm doing this ass backwards.
So... Once the DB gets the form data, it creates a temporary user record in an "on deck" table with a timestamp that can be used to determine when to delete the record if the user never follows up. Then I would have a function generate a random string of say 25 characters and store that in another field. Then I would create an MD5 checksum using the MD5 checksum of the user password + the random string + the temporary user_id as inputs. This string will then be used to create a URL with a unique POST variable and using the user_id as a prefix. Something like www.myurl.com/register.php?reg=[user_id][checksum]
Once the user clicks on the URL, the database finds the record with the user_id passed to it, then re-generates the checksum using the same inputs it has stored in the record and compares it to the checksum passed in the URL. If it passes, i move the temporary record to the permanent user table, delete the record and voila! (???)
posted by postergeist to technology (6 answers total) 1 user marked this as a favorite
posted by RustyBrooks at 9:06 AM on May 30, 2012 [1 favorite]