function is_auth_or_redirect($redirect = null) { $is_auth = is_auth(); if (empty($redirect)) { $redirect = "/login"; } if (!empty($redirect) && false == $is_auth) { if (stripos($redirect, 'login')) { web_setcookie('__webref', current_url(), null, '/'); } header("Location: " . $redirect); exit; } return $is_auth; }
public function clear() { web_setcookie(self::AUTH_COOKIE_KEY, null, null, '/'); web_setcookie(self::AUTH_MASTER_COOKIE_KEY, null, null, '/'); $this->_isEmpty = true; $this->_session = null; $this->_sign = null; $this->_adminId = null; }