public function _CheckLogin($pUsername) { $cookie = $_COOKIE['gLOGINSESSION']; $session = new cModel('UserSessions'); // Get the session by the identifier $criteria = array('Identifier' => $cookie); $session->Retrieve($criteria); $session->Fetch(); $UserId = $session->get('Account_FK'); if (!$UserId) { return false; } $authorization = new cModel('UserAccounts'); $criteria = array('Account_PK' => $UserId); $authorization->Retrieve($criteria); $authorization->Fetch(); $Username = strtolower($authorization->get('Username')); $pUsername = strtolower($pUsername); if ($Username == $pUsername) { return true; } return false; }