Page 1 of 1

Activation code, how would I make a different one each time

Posted: Wed Dec 06, 2006 4:41 pm
by Mythic Fr0st
So, on my game, you signup, you get an e-mail, however, I want it so you get an activation code, and then enter it into a box, and your registered...

So, they signup, they get the activation code

they type it in, and it finishes the signup...

so, how would I tell if its there first time logging in? and if the activation code is right O_O (and how would I make the activation code lolz, I was fiddling around with the uniqid() thing, that creates a unique id... but im not sure
( and how would I make sure its different each time

Posted: Wed Dec 06, 2006 5:02 pm
by Ollie Saunders
so, how would I tell if its there first time logging in?
Have a separate account confirmation page.
and if the activation code is right O_O
Store the code in the db and match it to the user's email address
and how would I make the activation code
Keep your salt hidden:

Code: Select all

$salt = 'somestring';
$uniqueId = md5($salt . time());

Posted: Wed Dec 06, 2006 6:24 pm
by Kieran Huggins
another idea is to combine the username with the MySQL InsertRowId in an MD5 hash.

The insertRowId would be private to your database (therefore difficult or impossible to guess from the outside) and it gives you don't have to cache the MD5 hash, since you can recreate it on the fly.

hehe - cache the hash.... I need to get out more :-(

Kieran

Posted: Wed Dec 06, 2006 6:38 pm
by Ollie Saunders
Yep, better.