login: save user access details to last.log
authorMischa POSLAWSKY <perl@shiar.org>
Wed, 4 Oct 2017 22:43:30 +0000 (00:43 +0200)
committerMischa POSLAWSKY <perl@shiar.org>
Wed, 4 Oct 2017 22:49:32 +0000 (00:49 +0200)
Mainly to check time of last successful login, with ip address and browser
to help debugging client issues (matching earlier data in forum columns
users.lastontime, users.lastip, users.useragent).

auth.inc.php

index b20331ac60ceb15d2f785d0301881e3f1f31b3ce..b8026f9712a2bc757a7628bac4d02afb390ddede 100644 (file)
@@ -24,6 +24,10 @@ function login($inuser, $inpass = NULL)
 
        if (function_exists('apache_note')) apache_note('user', $inuser);
 
+       if ($log = @fopen("$userdir/last.log", 'w')) {
+               fwrite($log, "{$_SERVER['REMOTE_ADDR']} {$_SERVER['HTTP_USER_AGENT']}\n");
+       }
+
        return [
                'name'  => $inuser,
                'admin' => file_exists("$userdir/.admin"),