/** * To destroy all the sessions associated with the current User. */ public static function destroyAllSessions($userID) { $allSessions = Session::getAllSessions($userID); //get all sessions associated with this user. foreach ($allSessions as $args) { SQL("DELETE FROM `SESSION_DATA` WHERE `SESSION_ID` = ?", array($args['SESSION_ID'])); SQL("DELETE FROM SESSION WHERE `SESSION_ID` = ?", array($args['SESSION_ID'])); } }
/** * Function to check if all sessions can be destroyed for the current user. */ public function testDestroyAllSessions() { //destroy all sessions Session::destroyAllSessions($this->session[0]->getUserID()); //try to get all sessions. Must return FALSE since no records were found $allSessions = Session::getAllSessions($this->session[0]->getUserID()); $this->assertFalse($allSessions); }