I have function to generate activation key when user creates new account.
How to check generated key is not generated in the past for other user
Database fields
username
password
email
activationcode
Function
function random_string($length) {
$key = '';
$keys = array_merge(range(0, 9),range('A', 'Z'), range(0, 9), range('a', 'z'));
for ($i = 0; $i < $length; $i++) {
$key .= $keys[array_rand($keys)];
}
return $key;
}
Code
echo random_string(65);