|
Posted by techcs on 09/14/06 19:58
Hi,
Wondering if anyine can help with the membership PHP script I lifted
from a tutorial. I'm new to PHP and have this system up and running but
my password only come out at three letters and sometime have a space in
them?? Anyway this is the code:
function makeRandomPassword($len = 8,$upper = 1,$number = 1) {
$salt = "abcdefghijklmnopqrstuvwxyz";
$uppercase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
$numbers = "1234567890";
if ($upper) $salt .= $uppercase;
if ($number) $salt .= $numbers;
srand((double)microtime()*1000000);
$i = 0;
while ($i <= $len) {
$num = rand() % strlen($salt);
$tmp = substr($salt, $num, 1);
$pass = $num . $tmp;
$i++;
};
return $pass;
};
$random_password = makeRandomPassword();
$db_password = md5($random_password);
Any ideas.. I need maybe 5 letters with no spaces...
Thanks
Col
Navigation:
[Reply to this message]
|