Page 1 of 1
Confirm registration email address with PHP?
Posted: Sun Dec 16, 2007 5:58 pm
by JAB Creations
So I have registration working just fine and dandy locally and would like to have folks who register confirm their email addresses actually exist. I would imagine the essentials would be to create some sort of URL with a unique string that is stored in the DB, sent in an email automated by PHP, and compared when clicked to validate the email address. I'm not sure where to start however. Any good examples or good threads to share?
Posted: Sun Dec 16, 2007 6:09 pm
by John Cartwright
It's not complicated at all
1) User registers at your site, insert record into the database
2) Update user record with a unique id of some sort, md5($username. rand(0, 100000) . microtime()) for example
3) Send the email with a link containing the unique id, i.e.
http://domain.com/confirm.php?id=YOUR_UNIQUE_HASH
4) Check for the existence of the hash in the database
5) If found, update user record to confirmed
Posted: Sun Dec 16, 2007 6:11 pm
by superdezign
Just know that users can use temporary email addresses if they don't want to use their "real" one, so there's really no way of actually knowing if it's theirs or not. You just hope for the best.