4 require_once(
'Services/Authentication/classes/class.ilSessionControl.php');
5 require_once(
'Services/Authentication/classes/class.ilSessionStatistics.php');
6 require_once(
'Services/Authentication/classes/class.ilSessionIStorage.php');
68 $q =
"SELECT data FROM usr_session WHERE session_id = ".
69 $ilDB->quote($a_session_id,
"text");
70 $set = $ilDB->query($q);
71 $rec = $ilDB->fetchAssoc($set);
84 global
$ilDB, $ilClientIniFile;
86 if (
$GLOBALS[
'WEB_ACCESS_WITHOUT_SESSION'])
98 "user_id" => array(
"integer", (
int)
$_SESSION[
"AccountId"]),
99 "expires" => array(
"integer", self::getExpireValue()),
100 "data" => array(
"clob", $a_data),
101 "ctime" => array(
"integer", $now),
102 "type" => array(
"integer", (
int) $_SESSION[
"SessionType"])
104 if ($ilClientIniFile->readVariable(
"session",
"save_ip"))
106 $fields[
"remote_addr"] = array(
"text", $_SERVER[
"REMOTE_ADDR"]);
111 $ilDB->update(
"usr_session", $fields,
112 array(
"session_id" => array(
"text", $a_session_id)));
116 $fields[
"session_id"] = array(
"text", $a_session_id);
117 $fields[
"createtime"] = array(
"integer", $now);
119 $ilDB->insert(
"usr_session", $fields);
122 $type = $fields[
"type"][1];
126 $type, $fields[
"createtime"][1], $fields[
"user_id"][1]);
151 if (! $a_session_id) {
156 $q =
"SELECT 1 FROM usr_session WHERE session_id = " . $ilDB->quote($a_session_id,
"text");
157 $set = $ilDB->query($q);
159 return $ilDB->numRows($set) > 0;
169 static function _destroy($a_session_id, $a_closing_context = null, $a_expired_at = null)
173 if(!$a_closing_context)
181 if(!is_array($a_session_id))
183 $q =
"DELETE FROM usr_session WHERE session_id = ".
184 $ilDB->quote($a_session_id,
"text");
191 $a_session_id = array_keys($a_session_id);
193 $q =
"DELETE FROM usr_session WHERE ".
194 $ilDB->in(
"session_id", $a_session_id,
"",
"text");
199 $ilDB->manipulate($q);
213 $q =
"DELETE FROM usr_session WHERE user_id = ".
214 $ilDB->quote($a_user_id,
"integer");
215 $ilDB->manipulate($q);
227 $q =
"SELECT session_id,expires FROM usr_session WHERE expires < ".
228 $ilDB->quote(time(),
"integer");
229 $res = $ilDB->query($q);
231 while(
$row = $ilDB->fetchAssoc(
$res))
233 $ids[
$row[
"session_id"]] = $row[
"expires"];
254 $new_session = $a_session_id;
257 $new_session = md5($new_session);
258 $q =
"SELECT * FROM usr_session WHERE ".
259 "session_id = ".$ilDB->quote($new_session,
"text");
260 $res = $ilDB->query($q);
261 }
while($ilDB->fetchAssoc(
$res));
263 $query =
"SELECT * FROM usr_session ".
264 "WHERE session_id = ".$ilDB->quote($a_session_id,
"text");
267 while (
$row = $ilDB->fetchObject(
$res))
292 return time() + ini_get(
'session.gc_maxlifetime');
318 return $ilClientIniFile->readVariable(
'session',
'expire');
351 $query =
"SELECT DISTINCT user_id FROM usr_session"
352 .
" WHERE remote_addr = " . $ilDB->quote($a_ip,
"text")
353 .
" AND user_id > 0";
359 $users[] =
$row->user_id;
370 static function set($a_var, $a_val)
381 static function get($a_var)
404 self::$closing_context = (int)$a_context;