Exemple #1
0
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>