function auth_page() { if (!session_is_vaild()) { // failed! error_page("Session non-exist or expired, please login again and make sure to turn on the cookie support."); exit; } return 0; }
include_once "config.php"; include_once "constant.php"; session_name($PBSWEBNAME); session_set_cookie_params($PBSWEBEXPTIME, $PBSWEBPATH); if (isset($_POST['loginnow']) && $_POST['loginnow'] == "true") { # from the login page, renew the session; i.e. logout! session_start(); setcookie($PBSWEBNAME, '', time() - 86400, $PBSWEBPATH); unset($_COOKIE[session_name()]); $_SESSION = array(); session_destroy(); } session_start(); setcookie(session_name(), session_id(), time() + $PBSWEBEXPTIME, $PBSWEBPATH); include_once "auth.php"; if (!session_is_vaild()) { // login! auth_login($_POST['username'], $_POST['password']); } else { $username = $_SESSION['username']; } $isAdmin = $_SESSION['isadmin']; ?> <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <title><?php echo $TITLE_MAINMENU; ?> </title>