function randomPassword($size=8) {
$alphabet = "abcdefghijklmnopqrstuwxyzABCDEFGHIJKLMNOPQRSTUWXYZ0123456789";
for ($i = 0; $i < $size; $i++) {
$n = rand(0, strlen($alphabet)-1);
$pass[$i] = $alphabet[$n];
}
return implode($pass);
}
echo $token = randomPassword();
$alphabet = "abcdefghijklmnopqrstuwxyzABCDEFGHIJKLMNOPQRSTUWXYZ0123456789";
for ($i = 0; $i < $size; $i++) {
$n = rand(0, strlen($alphabet)-1);
$pass[$i] = $alphabet[$n];
}
return implode($pass);
}
echo $token = randomPassword();
No comments:
Post a Comment