Skip to content

Commit d0dd670

Browse files
committed
re-add missing code for last commit
1 parent 118ed21 commit d0dd670

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

interface/web/login/index.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,6 +268,16 @@
268268
fwrite($authlog_handle, $authlog ."\n");
269269
fclose($authlog_handle);
270270
$app->db->query("INSERT INTO sys_login (`session_id`, `username`, `ip`, `login-time`) VALUES (?, ?, ?, CURRENT_TIMESTAMP) ON DUPLICATE KEY UPDATE `login-time`=CURRENT_TIMESTAMP", session_id(), $username, $_SERVER['REMOTE_ADDR']);
271+
272+
// get last IP used to login
273+
$user_data = $app->db->queryOneRecord("SELECT last_login_ip,last_login_at FROM sys_user WHERE username = ?", $username);
274+
275+
$_SESSION['s']['last_login_ip'] = $user_data['last_login_ip'];
276+
$_SESSION['s']['last_login_at'] = $user_data['last_login_at'];
277+
if(!$loginAs) {
278+
$app->db->query("UPDATE sys_user SET last_login_ip = ?, last_login_at = ? WHERE username = ?", $_SERVER['REMOTE_ADDR'], time(), $username);
279+
}
280+
271281
/*
272282
* We need LOGIN_REDIRECT instead of HEADER_REDIRECT to load the
273283
* new theme, if the logged-in user has another

0 commit comments

Comments
 (0)