function read($sessId) { $prefs = new Preferences(); $idle = $prefs->idleTime(); $expiry = time() - $idle; $query = "SELECT data FROM Sessions WHERE sessId='{$sessId}' AND lastAccess >= {$expiry}"; $data = parent::query($query); if (isset($data[0])) { return $data[0]['data']; } else { return ''; } }
function dataField($sessId) { $prefs = new Preferences(); $idle = $prefs->idleTime(); $expiry = time() - $idle; $query = "SELECT data FROM Sessions WHERE sessId='{$sessId}' AND lastAccess >= {$expiry}"; $session = parent::query($query); $validData = parent::validateIndexes($session, 0, 'data'); $vars = preg_split('/([a-z,A-Z]+)\\|/', $validData, -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE); if (isset($vars[1])) { $validData = unserialize($vars[1]); return $validData; } else { return null; } }