<?php
$GLOBALS ['username'] = "test";
$GLOBALS ['password'] = "test";
setcookie ( "cookie_user", "test", time () + 60 * 60 * 24 * 30 );
setcookie ( "cookie_pass", md5 ( "test" ), time () + 60 * 60 * 24 * 30 );
function validatelogin() {
if (strcmp ( $_COOKIE ['cookie_user'], $GLOBALS ['username'] ) == 0. &&
strcmp ( $_COOKIE ['cookie_pass'], md5 ( $GLOBALS ['password'] ) ) == 0) {
return true;
} else {
return false;
}
}
if (validatelogin ()) {
echo "Successfully logged in.";
} else {
echo "Sorry, invalid login.";
}
?>
|