i noticed many people asking how to do this and i needed it for my own login program... simple, quick fuction. probably a better way... but fine for me
//creates random string
//by: digirave
//input: $length
//return: $string
function randomstring($length) {
$randstring = "1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
srand ((double) microtime() * 1000000);
for($i = 0; $i < $length; $i++) {
$string .= $randstring[(int)rand(0, 61)];
}
return $string;
}