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');
65 $q =
"SELECT data FROM usr_session WHERE session_id = ".
66 $ilDB->quote($a_session_id,
"text");
67 $set = $ilDB->query($q);
68 $rec = $ilDB->fetchAssoc($set);
81 global $ilDB, $ilClientIniFile;
83 if (
$GLOBALS[
'WEB_ACCESS_WITHOUT_SESSION'])
95 "user_id" => array(
"integer", (
int)
$_SESSION[
"AccountId"]),
96 "expires" => array(
"integer", self::getExpireValue()),
97 "data" => array(
"clob", $a_data),
98 "ctime" => array(
"integer", $now),
99 "type" => array(
"integer", (
int) $_SESSION[
"SessionType"])
101 if ($ilClientIniFile->readVariable(
"session",
"save_ip"))
103 $fields[
"remote_addr"] = array(
"text", $_SERVER[
"REMOTE_ADDR"]);
108 $ilDB->update(
"usr_session", $fields,
109 array(
"session_id" => array(
"text", $a_session_id)));
113 $fields[
"session_id"] = array(
"text", $a_session_id);
114 $fields[
"createtime"] = array(
"integer", $now);
116 $ilDB->insert(
"usr_session", $fields);
119 $type = $fields[
"type"][1];
123 $type, $fields[
"createtime"][1], $fields[
"user_id"][1]);
148 $q =
"SELECT session_id FROM usr_session WHERE session_id = ".
149 $ilDB->quote($a_session_id,
"text");
150 $set = $ilDB->query($q);
151 if ($ilDB->fetchAssoc($set))
165 static function _destroy($a_session_id, $a_closing_context = null, $a_expired_at = null)
169 if(!$a_closing_context)
177 if(!is_array($a_session_id))
179 $q =
"DELETE FROM usr_session WHERE session_id = ".
180 $ilDB->quote($a_session_id,
"text");
187 $a_session_id = array_keys($a_session_id);
189 $q =
"DELETE FROM usr_session WHERE ".
190 $ilDB->in(
"session_id", $a_session_id,
"",
"text");
195 $ilDB->manipulate($q);
209 $q =
"DELETE FROM usr_session WHERE user_id = ".
210 $ilDB->quote($a_user_id,
"integer");
211 $ilDB->manipulate($q);
223 $q =
"SELECT session_id,expires FROM usr_session WHERE expires < ".
224 $ilDB->quote(time(),
"integer");
225 $res = $ilDB->query($q);
227 while(
$row = $ilDB->fetchAssoc(
$res))
229 $ids[
$row[
"session_id"]] = $row[
"expires"];
250 $new_session = $a_session_id;
253 $new_session = md5($new_session);
254 $q =
"SELECT * FROM usr_session WHERE ".
255 "session_id = ".$ilDB->quote($new_session,
"text");
256 $res = $ilDB->query($q);
257 }
while($ilDB->fetchAssoc(
$res));
259 $query =
"SELECT * FROM usr_session ".
260 "WHERE session_id = ".$ilDB->quote($a_session_id,
"text");
263 while (
$row = $ilDB->fetchObject(
$res))
288 return time() + ini_get(
'session.gc_maxlifetime');
314 return $ilClientIniFile->readVariable(
'session',
'expire');
347 $query =
"SELECT DISTINCT user_id FROM usr_session"
348 .
" WHERE remote_addr = " . $ilDB->quote($a_ip,
"text")
349 .
" AND user_id > 0";
355 $users[] =
$row->user_id;
366 static function set($a_var, $a_val)
377 static function get($a_var)
400 self::$closing_context = (int)$a_context;