added loginLogging - jsonVersion
This commit is contained in:
7
homepage/participo/.htaccess
Normal file
7
homepage/participo/.htaccess
Normal file
@@ -0,0 +1,7 @@
|
||||
# Url-Rewriting aktivieren
|
||||
RewriteEngine on
|
||||
# Wenn * angefordert wurde und *.php existiert
|
||||
RewriteCond %{REQUEST_FILENAME}.php -f
|
||||
# Hänge ein \.php an
|
||||
RewriteRule ^(.*)$ $1\.php
|
||||
|
||||
@@ -36,14 +36,15 @@ function checkCredentials($username, $password, $db_server, $db_user, $db_passwo
|
||||
$message['success'] = 'Anmeldung erfolgreich, <a href="index.php">weiter zum Inhalt</a>.';
|
||||
PHPCount::AddHit("participo-Login-".$_POST['f']['username']);
|
||||
|
||||
$lastLogins=file("logins.txt");
|
||||
$file = fopen("logins.txt", "w");
|
||||
fwrite($file, $_POST['f']['username']."\n");
|
||||
for ( $i=0;i<30;++$i)
|
||||
{
|
||||
fwrite($file, $lastLoggins."\n");
|
||||
}
|
||||
fclose($file);
|
||||
// Logging Logins
|
||||
$userName = $_SESSION['user']['username'];
|
||||
$lastLogins = json_decode(file_get_contents("lastLogins.json"), true);
|
||||
if(!array_key_exists($userName, $lastLogins))
|
||||
$lastLogins[$userName] = [];
|
||||
if(!array_key_exists('lastLogins', $lastLogins[$userName]))
|
||||
$lastLogins[$userName]['lastLogins'] = [];
|
||||
$lastLogins[$userName]['lastLogins'] = array_merge( array( date('Y-m-d H:i:s') ), $lastLogins[$userName]['lastLogins'] );
|
||||
file_put_contents("lastLogins.json", json_encode($lastLogins));
|
||||
|
||||
header('Location: http://' . $_SERVER['HTTP_HOST'] . '/participo?user=' . $_POST['f']['username']);
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user