function cp_session_authenticate($cookie) { parse_str($cookie, $cookie_data); $filename = DIR_CP_SESSION . '/' . file_sanitize($cookie_data[CP_SESSION_FIELD]); if (file_exists($filename) && is_file($filename)) { list($username, $session, $timestamp, $browser, $ip) = explode('|', file_first_line($filename)); if ($username == $cookie_data[CP_USERNAME_FIELD] && $browser == sha1($_SERVER['HTTP_USER_AGENT']) && $ip == $_SERVER['REMOTE_ADDR']) { define('CP_LOGGED_IN_USERNAME', $username); return true; } cp_logout(); return 'Invalid control panel account'; } else { cp_logout(); return 'Your control panel session has expired'; } }
function _xLogout() { cp_logout(); include 'login.php'; }