else if($result == 2){
die(\'Incorrect password, please try again.\');
}
/* Username and password correct, register session variables */
$_POST[\'user\'] = stripslashes($_POST[\'user\']);
$_SESSION[\'username\'] = $_POST[\'user\'];
$_SESSION[\'password\'] = $md5pass;
/**
* This is the cool part: the user has requested that we remember that
* he\'s logged in, so we set two cookies. One to hold his username,
* and one to hold his md5 encrypted password. We set them both to
* expire in 100 days. Now, next time he comes to our site, we will
* log him in automatically.
*/
if(isset($_POST[\'remember\'])){
setcookie(\"cookname\", $_SESSION[\'username\'], time()+60*60*24*100, \"/\");
setcookie(\"cookpass\", $_SESSION[\'password\'], time()+60*60*24*100, \"/\");
}
/* Quick self-redirect to avoid resending data on refresh */
echo \"<meta http-equiv=\\\"Refresh\\\" content=\\\"0;url=$HTTP_SERVER_VARS[PHP_SELF]\\\">\";
return;
}
/* Sets the value of the logged_in variable, which can be used in your code */
$logged_in = checkLogin();