Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

Verifying a login cookie

unset($username);
if (isset($_COOKIE['login'])) { 
   list($c_username, $cookie_hash) = split(',', $_COOKIE['login']); 
   if (md5($c_username.$secret_word) == $cookie_hash) { 
     $username = $c_username; 
   }else{ 
     print "You have sent a bad cookie."; 
   } 
} 


if (isset($username)) {
   print "Welcome, $username."; 
}else{
   print "Welcome, anonymous user."; 
}
Source by softwarezay.com #
 
PREVIOUS NEXT
Tagged: #Verifying #login #cookie
ADD COMMENT
Topic
Name
8+9 =