public function delOutdatedSessions($expmin) { $exptime = nowMinuts() - $expmin; settype($exptime, 'integer'); $sql = "DELETE FROM dvsession WHERE time < {$exptime}"; $result = $this->db->query($sql); if (!$result) { throw new DBException('mysql error (' . $this->db->errno . ') ' . $this->db->error); } return is_object($result) ? $result->num_rows : 0; }
private function initSession($obj, $ip) { $sid = randHash(); $sess['sid'] = $sid; $sess['uid'] = 'guest'; $sess['time'] = nowMinuts(); $sess['ip'] = $ip; $sess['authed'] = '0'; // $sess['userinfo'] = array(); // $this->db->putObject_($sess, 'sess unauth'/*, $this->root*/); $this->db->saveSession($sess); $retobj['sid'] = $sid; $ret['result'] = "success"; $ret['objs'] = $retobj; return $ret; }