note 16311 deleted from function.md5 by jimw
| From: | jimw@php.net | Date: | Sat, 08 Dec 2001 20:03:08 +0000 |
| Subject: | note 16311 deleted from function.md5 by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-22173@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"] );