Log in

View Full Version : 16 chars?



alexjewell
01-23-2007, 11:38 PM
The following code, after reading it, I assume it creates a random string of 16 characters. What exactly can the purpose of this be?



$len = 16;
$base='ABCDEFGHKLMNOPQRSTWXYZabcdefghjkmnpqrstwxyz123456789';
$max=strlen($base)-1;
$activatecode='';
mt_srand((double)microtime()*1000000);
while (strlen($activatecode)<$len+1)
$activatecode.=$base{mt_rand(0,$max)};

echo $activatecode;

Twey
01-23-2007, 11:58 PM
Presumably an activation code.

They'd have an easier time with md5() though.

alexjewell
01-24-2007, 12:41 AM
Activation code?

djr33
01-24-2007, 01:30 AM
Like... "click this link" (.../page.php?code=dfjaslkfksajkldfjklsaf), and then it does something, like generates a password for you or something.