Commit 5660816e authored by Lukas Fleischer's avatar Lukas Fleischer
Browse files

Save last login IP address



Save the IP address used for the last login in the "Users" table. This
makes it a bit easier to create IP ban lists for spammers without
looking at web server logs.

Signed-off-by: default avatarLukas Fleischer <archlinux@cryptocrack.de>
parent de39a712
Upgrading
=========
From 2.1.0 to 2.2.0
-------------------
1. Add new "Users" table login IP address column:
----
ALTER TABLE Users
ADD COLUMN LastLoginIPAddress INTEGER UNSIGNED NOT NULL DEFAULT 0;
----
From 2.0.0 to 2.1.0
-------------------
......
......@@ -34,6 +34,7 @@ CREATE TABLE Users (
PGPKey VARCHAR(40) NULL DEFAULT NULL,
LastVoted BIGINT UNSIGNED NOT NULL DEFAULT 0,
LastLogin BIGINT UNSIGNED NOT NULL DEFAULT 0,
LastLoginIPAddress INTEGER UNSIGNED NOT NULL DEFAULT 0,
PRIMARY KEY (ID),
UNIQUE (Username),
UNIQUE (Email),
......
......@@ -444,7 +444,8 @@ function try_login() {
}
if ($logged_in) {
$q = "UPDATE Users SET LastLogin = UNIX_TIMESTAMP() ";
$q = "UPDATE Users SET LastLogin = UNIX_TIMESTAMP(), ";
$q.= "LastLoginIPAddress = " . $dbh->quote(ip2long($_SERVER['REMOTE_ADDR'])) . " ";
$q.= "WHERE ID = '$userID'";
$dbh->exec($q);
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment