foreveralone

foreveralone Commit Details


Date:2016-02-28 14:54:56 (8 years 9 months ago)
Author:Natalie Adams
Branch:master
Commit:459a016654ddfb51e1e4d1d9b60d3eecbdc75190
Parents: b2984e8c318473828bcfd4babbff9b01b32f65c4
Message:Issue 129: Add session logging

Changes:

File differences

web/application/controllers/base.php
3434
3535
3636
37
3738
3839
3940
......
4445
4546
4647
47
48
49
4850
4951
5052
5153
54
55
56
57
58
59
60
61
62
5263
5364
5465
$this->session->sessionid = $sessionId;
$this->session->random = 0;
$this->session->save();
$this->saveSession();
setcookie("session", $sessionId, 2147483647, "/");
}
} else {
$this->session->userAgent = $_SERVER["HTTP_USER_AGENT"];
$this->session->sessionid = $sessionId;
$this->session->random = 0;
$this->session->id = $this->session->save();
$this->session->save();
$this->saveSession();
setcookie("session", $sessionId, 2147483647, "/");
}
}
protected function saveSession() {
$sessionlog = new \application\models\Sessionlogs();
$sessionlog->ip = $this->session->ip;
$sessionlog->original_id = $this->session->id;
$sessionlog->userAgent = $this->session->userAgent;
$sessionlog->sessionid = $this->session->sessionid;
$sessionlog->save();
}
public function __construct($config, $core, $tpl)
{
parent::__construct($config, $core, $tpl);
web/application/migrations/1.php
1515
1616
1717
18
19
20
21
22
23
24
25
1826
to_user INTEGER,
lastPing INTEGER,
random TINYINT(1)
)");
DB::query("CREATE TABLE sessionlogs (
id INTEGER PRIMARY KEY $autoIncrement,
original_id INTEGER,
sessionid VARCHAR(255),
ip VARCHAR(255),
userAgent VARCHAR(255)
)");
web/application/models/sessionlogs.php
1
2
3
4
5
6
7
8
9
10
<?php
namespace application\models;
class Sessionlogs extends \system\engine\HF_Model {
public $original_id;
public $sessionid;
public $ip;
public $userAgent;
}

Archive Download the corresponding diff file

Branches

Tags

Number of commits:
Page rendered in 0.06537s using 20 queries.