added lastLogins-Logging

This commit is contained in:
marko
2021-12-20 15:42:21 +01:00
parent 4cb5e3ee47
commit 1a3f81bd33
4 changed files with 64 additions and 13 deletions

View File

@@ -64,9 +64,7 @@ if( empty($someOptions['dontFetch' ]) ) $someOptions['dontFetch' ] = false;
if(!$pdoResult){
echo("Error during dbQuery!\n");
echo("DB-Error:\n"); var_dump($aDbConnection->errorInfo());
// var_dump($aQueryString);
// var_dump($aBindArray);
// echo($pdoStatement.errorInfo());
}
if($someOptions['dontFetch']){
$ret = NULL;
@@ -91,9 +89,6 @@ if( empty($someOptions['dontFetch' ]) ) $someOptions['dontFetch' ] = false;
);
}
}
//var_dump($ret);
//var_dump($aQueryString);
//var_dump($aBindArray);
return $ret;
}

View File

@@ -12,6 +12,14 @@ setlocale (LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
require_once($config['basePath']."/config/cwsvJudo.config.php");
require_once($config['basePath']."/config/phpcount.config.php");
$dbConnection = getPdoDbConnection(
$cwsvJudoConfig["db"]["host"],
$cwsvJudoConfig["db"]["name"],
$cwsvJudoConfig["db"]["user"],
$cwsvJudoConfig["db"]["password"]
);
$userData = getUserData($dbConnection, $_SESSION['user']['userId']);
?>
<!DOCTYPE html>
<html>
@@ -64,6 +72,11 @@ setlocale (LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
<li class="bold">
<a class="waves-effect waves-teal" href="#Configs">UserInfos</a>
</li>
<?php if( isUserAdmin($dbConnection, $userData['id']) ){?>
<li class="bold">
<a class="waves-effect waves-teal" href="#Admin">adminStuff</a>
</li>
<?php }?>
</ul>
</header>
@@ -130,6 +143,42 @@ if($_SESSION['login']){
</div>
</div>
<?php if( isUserAdmin($dbConnection, $userData['id']) ){?>
<div class="divider"></div>
<div class="row" id="Admin">
<div style="padding:1%;" class="col s12 m6">
<div style="margin:1%;" class="card blue-grey darken-1">
<div class="card-content white-text">
<span class="card-title">lastLogins</span>
<img style="max-height:10vh;" class="responsive-img" src="images/account.svg" />
<p>Die letzten Logins der einzelnen User</p>
<?php $lastLogins=json_decode( file_get_contents("lastLogins.json"), true);?>
<table>
<thead>
<tr>
<th>userName</th>
<th>lastLogins</th>
</tr>
</thead>
<tbody>
<?php foreach( $lastLogins as $userName => $lastLogins ){ ?>
<tr>
<td><?php echo( $userName );?></td>
<td><?php echo( $lastLogins['lastLogins'][0] );?></td>
</tr>
<?php }?>
</tbody>
</table>
</div>
<div class="card-action">
</div>
</div>
</div>
</div>
<?php }?>
</main>
<?php
}

View File

@@ -5,9 +5,6 @@ setlocale (LC_ALL, 'de_DE@euro', 'de_DE', 'de', 'ge');
require_once("config/participo.php");
require_once("./local/dbConf.php");
// require_once("./local/achievementsConf.php");
// require_once("./lib/achievementsLib.php");
$basePath = $config['basePath'];
require_once($basePath."/config/phpcount.config.php");
@@ -37,7 +34,17 @@ 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']);
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);
header('Location: http://' . $_SERVER['HTTP_HOST'] . '/participo?user=' . $_POST['f']['username']);
} else {
sleep(5);