public function logout() { $objLogin = Core_Classes_coreObj::getLogin(); $objLogin->logout($_GET['check']); }
/** * Determines the users state & updates / init's new sessions as needed * * @version 1.0 * @since 1.0 * @author Dan Aldridge * */ public function trackerInit() { $update = false; $rmCookie = false; $logout = false; $action = null; $objLogin = Core_Classes_coreObj::getLogin(); $objSQL = Core_Classes_coreObj::getDBO(); $objUse = Core_Classes_coreObj::getUser(); // if the user is logged in if (Core_Classes_User::$IS_ONLINE) { $action = 'check user key, and reset if needed'; if (is_empty(doArgs('userkey', null, $this->config('global', 'user')))) { //$this->newKey(); } // force update $update = true; } else { // check for remember me if (!is_empty(doArgs('login', null, $_COOKIE))) { // try and remember who they are, this sometimes is hard, but we try anyway if (!$objLogin->rememberMe()) { $action = 'remove remember me cookie'; $rmCookie = true; // you should be logged in now, so redirect } else { $action = 'remember me worked'; $objPage->redirect('', 1); exit; } // no remember me found, lets treat them as a new guest } else { $online = $this->getData(); if (!is_array($online)) { $action = 'register new guest'; $this->newSession(); } else { $action = 'update guest'; $update = true; } } } if ($update === true) { // we haven't got any data about this user, lets get some if (!isset($online)) { $online = $this->getData(); } // perform an action based on the database switch if (isset($online['mode'])) { LOCALHOST ? debugLog($online['mode'], 'mode') : ''; switch (strtolower($online['mode'])) { default: case 'active': $action = 'update user location'; if (Core_Classes_User::$IS_ONLINE && $online['username'] == 'Guest') { $query = $objSQL->queryBuilder->deleteFrom('#__sessions')->where('userkey', '=', $objUser->grab('userkey')); $objSQL->query($query->build()); $this->newSession(); } $this->updateTime(); break; case 'kill': $action = 'kill user'; // and log em out $logout = true; break; case 'ban': $action = 'ban user'; // ban the user account if they are online if (IS_ONLINE) { $objUser->toggle($objUser->grab('id'), 'ban', true); // ban the ip if they are a guest } else { // TODO: sort this out //$this->banIP( Core_Classes_User::getIP() ); } $logout = true; break; case 'update': $action = 'update user info'; //so we want to grab a new set of sessions if (IS_ONLINE) { $this->setSessions($this->grab('id')); } break; } } } LOCALHOST ? debugLog($action, 'action') : ''; LOCALHOST ? debugLog($update, 'update') : ''; return $this; }