Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

verify that a valid login cookie was sent in order to do special things for that logged-in

unset($username);
if ($_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 ($username) {
    print "Welcome, $username.";
} else {
    print "Welcome, anonymous user.";
}
Source by docstore.mik.ua #
 
PREVIOUS NEXT
Tagged: #verify #valid #login #cookie #order #special
ADD COMMENT
Topic
Name
2+6 =