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');
64 $q =
"SELECT data FROM usr_session WHERE session_id = ".
65 $ilDB->quote($a_session_id,
"text");
66 $set = $ilDB->query($q);
67 $rec = $ilDB->fetchAssoc($set);
80 global $ilDB, $ilClientIniFile;
82 if (
$GLOBALS[
'WEB_ACCESS_WITHOUT_SESSION'])
94 "user_id" => array(
"integer", (
int)
$_SESSION[
"AccountId"]),
95 "expires" => array(
"integer", self::getExpireValue()),
96 "data" => array(
"clob", $a_data),
97 "ctime" => array(
"integer", $now),
98 "type" => array(
"integer", (
int) $_SESSION[
"SessionType"])
100 if ($ilClientIniFile->readVariable(
"session",
"save_ip"))
102 $fields[
"remote_addr"] = array(
"text", $_SERVER[
"REMOTE_ADDR"]);
107 $ilDB->update(
"usr_session", $fields,
108 array(
"session_id" => array(
"text", $a_session_id)));
112 $fields[
"session_id"] = array(
"text", $a_session_id);
113 $fields[
"createtime"] = array(
"integer", $now);
115 $ilDB->insert(
"usr_session", $fields);
118 $type = $fields[
"type"][1];
122 $type, $fields[
"createtime"][1], $fields[
"user_id"][1]);
147 $q =
"SELECT session_id FROM usr_session WHERE session_id = ".
148 $ilDB->quote($a_session_id,
"text");
149 $set = $ilDB->query($q);
150 if ($ilDB->fetchAssoc($set))
164 static function _destroy($a_session_id, $a_closing_context = null, $a_expired_at = null)
168 if(!$a_closing_context)
176 if(!is_array($a_session_id))
178 $q =
"DELETE FROM usr_session WHERE session_id = ".
179 $ilDB->quote($a_session_id,
"text");
186 $a_session_id = array_keys($a_session_id);
188 $q =
"DELETE FROM usr_session WHERE ".
189 $ilDB->in(
"session_id", $a_session_id,
"",
"text");
194 $ilDB->manipulate($q);
208 $q =
"DELETE FROM usr_session WHERE user_id = ".
209 $ilDB->quote($a_user_id,
"integer");
210 $ilDB->manipulate($q);
222 $q =
"SELECT session_id,expires FROM usr_session WHERE expires < ".
223 $ilDB->quote(time(),
"integer");
224 $res = $ilDB->query($q);
226 while(
$row = $ilDB->fetchAssoc(
$res))
228 $ids[
$row[
"session_id"]] = $row[
"expires"];
249 $new_session = $a_session_id;
252 $new_session = md5($new_session);
253 $q =
"SELECT * FROM usr_session WHERE ".
254 "session_id = ".$ilDB->quote($new_session,
"text");
255 $res = $ilDB->query($q);
256 }
while($ilDB->fetchAssoc(
$res));
258 $query =
"SELECT * FROM usr_session ".
259 "WHERE session_id = ".$ilDB->quote($a_session_id,
"text");
262 while (
$row = $ilDB->fetchObject(
$res))
287 return time() + ini_get(
'session.gc_maxlifetime');
313 return $ilClientIniFile->readVariable(
'session',
'expire');
346 $query =
"SELECT DISTINCT user_id FROM usr_session"
347 .
" WHERE remote_addr = " . $ilDB->quote($a_ip,
"text")
348 .
" AND user_id > 0";
354 $users[] =
$row->user_id;
365 static function set($a_var, $a_val)
376 static function get($a_var)
399 self::$closing_context = (int)$a_context;