本文整理匯總了PHP中UserSession::IsLoggedIn方法的典型用法代碼示例。如果您正苦於以下問題:PHP UserSession::IsLoggedIn方法的具體用法?PHP UserSession::IsLoggedIn怎麽用?PHP UserSession::IsLoggedIn使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類UserSession
的用法示例。
在下文中一共展示了UserSession::IsLoggedIn方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: UserSession
if (isset($_POST["logout"])) {
session_destroy();
session_start();
}
$user_session = null;
$logged_in = false;
if (isset($_SESSION['UserSession'])) {
// if the session is already in-progress see whether a user is logged in
$user_session = $_SESSION['UserSession'];
$logged_in = $user_session->IsLoggedIn();
} else {
// if there is no user session and a user and password are provided, attempt to log in
if (isset($_POST["username"]) && isset($_POST["password"])) {
$user_session = new UserSession();
if ($user_session->LogIn($_POST["username"], $_POST["password"])) {
$logged_in = $user_session->IsLoggedIn();
$_SESSION['UserSession'] = $user_session;
}
}
}
if ($logged_in) {
header("Location:server_admin.php");
die;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html style="background-color: #35363D" xmlns="http://www.w3.org/1999/xhtml">
<head>
<link rel="stylesheet" href="css/mainstyle.css" type="text/css"/>
<title>OpenSauce Halo CE Map Server</title>
</head>