note 21847 added to function.md5
| From: | php-general at lists dot php dot net | Date: | Wed, 29 May 2002 09:51:26 +0000 |
| Subject: | note 21847 added to function.md5 | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-31141@lists.php.net to get a copy of this message | ||
Follow-up from devans_nospam@law.uchicago.nospam.edu
I take it from what you were mentioning the modified script from dpiper@stens.com would look
something like:
function generatekey($count)
{
// using a predetermined character set
// in this example the characters ! $ 0-9 @ A-Z a-z
mt_srand((double)microtime()*1000000);
$key = "";
for ($i=0; $i<$count; $i++)
{
$rndchr=mt_rand(0,64);
if ($rndchr==0) {
$c=chr(33);
} elseif ($rndchr==1) {$c=chr(36);
} elseif ($rndchr<=11) {$c=chr(46+$rndchr);
} elseif ($rndchr<=38) {$c=chr((52+$rndchr));
} else {$c=chr(58+$rndchr);
};
$key .= $c;
}
return $key;
}
--
http://www.php.net/manual/en/function.md5.php
http://master.php.net/manage/user-notes.php?action=edit+21847
http://master.php.net/manage/user-notes.php?action=delete+21847
http://master.php.net/manage/user-notes.php?action=reject+21847