note 16311 added to function.md5
| From: | dennis dot toddenroth at dont-mail dot please | Date: | Wed, 24 Oct 2001 14:52:29 +0000 |
| Subject: | note 16311 added to function.md5 | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-19376@lists.php.net to get a copy of this message | ||
A login system can contain user specific information (e.g. client ip, time) to increase protection -
users tend to forget logging out. I put that data with a md5 of that data together with the password
in a cookie:
define ("VALID_TIME", 3600 ); // one hour
function PackHash ($Username, $Valid, $Password )
{
$str= "u=". $Username. "&v=". $Valid. "&p=". md5 ($Username.
$Valid. $Password. getenv ("REMOTE_ADDR" ));
return bin2hex ($str );
}
$AUTH_HASH= PackHash ($data["username"], time ()+ VALID_TIME,
$data["password"] );
--
http://www.php.net/manual/en/function.md5.php
http://master.php.net/manage/user-notes.php?action=edit+16311
http://master.php.net/manage/user-notes.php?action=delete+16311
http://master.php.net/manage/user-notes.php?action=reject+16311