Commit a21739aa authored by Dan McGee's avatar Dan McGee Committed by Lukas Fleischer
Browse files

Add LastLogin column to Users table



Signed-off-by: default avatarDan McGee <dan@archlinux.org>
Signed-off-by: default avatarLukas Fleischer <archlinux@cryptocrack.de>
parent e6ecdcc8
Upgrading Upgrading
========= =========
From 1.9.0 to 1.9.X
-------------------
1. Add new "Users" table login date column:
ALTER TABLE Users ADD COLUMN LastLogin BIGINT NOT NULL DEFAULT 0;
From 1.8.2 to 1.9.0 From 1.8.2 to 1.9.0
------------------- -------------------
......
...@@ -32,6 +32,7 @@ CREATE TABLE Users ( ...@@ -32,6 +32,7 @@ CREATE TABLE Users (
LangPreference VARCHAR(5) NOT NULL DEFAULT 'en', LangPreference VARCHAR(5) NOT NULL DEFAULT 'en',
IRCNick VARCHAR(32) NOT NULL DEFAULT '', IRCNick VARCHAR(32) NOT NULL DEFAULT '',
LastVoted BIGINT UNSIGNED NOT NULL DEFAULT 0, LastVoted BIGINT UNSIGNED NOT NULL DEFAULT 0,
LastLogin BIGINT UNSIGNED NOT NULL DEFAULT 0,
PRIMARY KEY (ID), PRIMARY KEY (ID),
UNIQUE (Username), UNIQUE (Username),
UNIQUE (Email), UNIQUE (Email),
......
...@@ -637,8 +637,11 @@ function try_login() { ...@@ -637,8 +637,11 @@ function try_login() {
} }
if ($logged_in) { if ($logged_in) {
# set our SID cookie $q = "UPDATE Users SET LastLogin = UNIX_TIMESTAMP() ";
$q.= "WHERE ID = '$userID'";
db_query($q, $dbh);
# set our SID cookie
if (isset($_POST['remember_me']) && if (isset($_POST['remember_me']) &&
$_POST['remember_me'] == "on") { $_POST['remember_me'] == "on") {
# Set cookies for 30 days. # Set cookies for 30 days.
......
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