public static function isUserLoggedIn() { if (isset($_SESSION['ee_user_name'], $_SESSION['ee_user_pass'])) { if (GateKeeper::isUser($_SESSION['ee_user_name'], $_SESSION['ee_user_pass'])) { return true; } } return false; }
/** * check user satus * * @return $message */ public static function init() { global $encodeExplorer; global $gateKeeper; global $cookies; if (isset($_GET['logout'])) { setcookie("rm", "", time() - 60 * 60 * 24 * 365); $_SESSION['vfm_user_name'] = null; $_SESSION['vfm_logged_in'] = null; $_SESSION['vfm_user_used'] = null; $_SESSION['vfm_dlist'] = null; // session_destroy(); } else { $cookies->checkCookie(); } $postusername = filter_input(INPUT_POST, "user_name", FILTER_SANITIZE_STRING); $postuserpass = filter_input(INPUT_POST, "user_pass", FILTER_SANITIZE_STRING); $postcaptcha = filter_input(INPUT_POST, "captcha", FILTER_SANITIZE_STRING); $rememberme = filter_input(INPUT_POST, "vfm_remember", FILTER_SANITIZE_STRING); if ($postusername && $postuserpass) { if (Utils::checkCaptcha($postcaptcha) == true) { if (GateKeeper::isUser($postusername, $postuserpass)) { if ($rememberme == "yes") { $cookies->setCookie($postusername); } $_SESSION['vfm_user_name'] = $postusername; $_SESSION['vfm_logged_in'] = 1; if ($gateKeeper->getUserSpace() !== false) { $userspace = $gateKeeper->getUserInfo('quota') * 1024 * 1024; $usedspace = $gateKeeper->getUserSpace(); $_SESSION['vfm_user_used'] = $usedspace; $_SESSION['vfm_user_space'] = $userspace; } if (SetUp::getConfig("notify_login")) { Logger::emailNotification('--', 'login'); } header("location:?dir="); } else { $encodeExplorer->setErrorString("wrong_pass"); } } else { $encodeExplorer->setErrorString("wrong_captcha"); } } }