This commit is contained in:
Janis Steiner
2025-01-01 17:43:04 +01:00
parent 96f4b45a6f
commit 6ddbe08a25
2 changed files with 3 additions and 2 deletions

View File

@@ -64,7 +64,7 @@ else if ($_SESSION["needs_auth"]===false && $_SESSION["mfa_authenticated"]==1 &&
];
}
//update last login
$ip=$_SERVER["HTTP_X_FORWARDED_FOR"];
$ip=trim(explode(",",$_SERVER["HTTP_X_FORWARDED_FOR"])[0]);
$date=date('Y-m-d H:i:s');
$last_login_msg=$date." from ".$ip;
$sql="UPDATE users SET last_login = ? WHERE id = ?";

View File

@@ -18,7 +18,8 @@ mysqli_stmt_fetch($stmt);
mysqli_stmt_close($stmt);
//send telegram message
$device = $_SERVER['HTTP_USER_AGENT'];
$ip=$_SERVER["REMOTE_ADDR"];
//$ip=$_SERVER["REMOTE_ADDR"];
$ip=trim(explode(",",$_SERVER["HTTP_X_FORWARDED_FOR"])[0]);
$location=get_location_from_ip($ip);
$date=date('Y-m-d H:i:s');
$token=bin2hex(random_bytes(128));