note 54782 added to function.md5
| From: | HeeroEYuy at osu1 dot php dot net | Date: | Thu, 14 Jul 2005 20:35:19 +0000 |
| Subject: | note 54782 added to function.md5 | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-91989@lists.php.net to get a copy of this message | ||
Great Suggestion Helpful Harry. One tiny Problem on the encode function. When the seed initially
tries to concatenate itself, you end up with the following error in your web log (or in the php
error log on older PHP compilations):
PHP Notice: Undefined variable: seed in yourpath/this_password_func.php on line 17 ...
rewrote the encode function alittle:
<?php
function pw_encode($password)
{
$seed = NULL;
for ($i = 0; $i < 8; $i++)
{
$seed .= substr('0123456789abcdef', rand(0,15), 1);
}
$encoded_string = md5($seed.$password).$seed;
return $encoded_string;
}
?>
Hope this helps, helped me...
GREAT FUNCTIONS HARRY, I ESPECIALL LIKE THIS ONE, THANK YOU AGAIN!!!
----
Manual Page -- http://www.php.net/manual/en/function.md5.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+54782
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+54782&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+54782&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+54782&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+54782&report=yes&reason=useless
Delete: non-english -- http://master.php.net/manage/user-notes.php?action=delete+54782&report=yes&reason=non-english
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+54782&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+54782&report=yes
Search -- http://master.php.net/manage/user-notes.php