updateslog
This commit is contained in:
parent
e9bd5a783c
commit
3789b02dfd
28
www/ajax/ul_entries.php
Normal file
28
www/ajax/ul_entries.php
Normal file
@ -0,0 +1,28 @@
|
|||||||
|
<?php
|
||||||
|
require_once (__DIR__ . '/../internals/base.php');
|
||||||
|
require_once (__DIR__ . '/../internals/database.php');
|
||||||
|
require_once (__DIR__ . '/../internals/updateslog.php');
|
||||||
|
|
||||||
|
Database::connect();
|
||||||
|
|
||||||
|
?>
|
||||||
|
<div class="stripedtable_container" style="width: 100%;">
|
||||||
|
<table class="stripedtable">
|
||||||
|
<thead>
|
||||||
|
<tr>
|
||||||
|
<th>IP</th>
|
||||||
|
<th>Version</th>
|
||||||
|
<th>Timestamp</th>
|
||||||
|
</tr>
|
||||||
|
</thead>
|
||||||
|
<tbody>
|
||||||
|
<?php foreach (UpdatesLog::getEntries($_GET['ulname'], 512) as $entry): ?>
|
||||||
|
<tr>
|
||||||
|
<td><?php echo $entry['ip']; ?></td>
|
||||||
|
<td><?php echo $entry['version']; ?></td>
|
||||||
|
<td><?php echo $entry['date']; ?></td>
|
||||||
|
</tr>
|
||||||
|
<?php endforeach; ?>
|
||||||
|
</tbody>
|
||||||
|
</table>
|
||||||
|
</div>
|
@ -43,6 +43,7 @@ $URL_RULES =
|
|||||||
[ 'url' => ['api', 'webhook', '${target}'], 'target' => 'pages/api_webhook.php', 'options' => [ '_opt' => 'http', 'target' => '%URL%', 'secret' => '%GET%', ],],
|
[ 'url' => ['api', 'webhook', '${target}'], 'target' => 'pages/api_webhook.php', 'options' => [ '_opt' => 'http', 'target' => '%URL%', 'secret' => '%GET%', ],],
|
||||||
|
|
||||||
[ 'url' => ['admin'], 'target' => 'pages/admin.php', 'options' => [ '_opt' => 'password'], ],
|
[ 'url' => ['admin'], 'target' => 'pages/admin.php', 'options' => [ '_opt' => 'password'], ],
|
||||||
|
[ 'url' => ['admin', 'updateslog', '${name}'], 'target' => 'pages/admin_ul-list.php', 'options' => [ '_opt' => 'password', 'name' => '%URL%'],],
|
||||||
[ 'url' => ['admin', 'cmd', '?{cmd}'], 'target' => 'pages/admin_cmd.php', 'options' => [ '_opt' => 'password', 'cmd' => '%URL%'], ],
|
[ 'url' => ['admin', 'cmd', '?{cmd}'], 'target' => 'pages/admin_cmd.php', 'options' => [ '_opt' => 'password', 'cmd' => '%URL%'], ],
|
||||||
[ 'url' => ['admin', 'egh', '?{cmd}'], 'target' => 'pages/su_ajax.php', 'options' => [ 'suffix' => 'egh', 'cmd' => '%URL%', 'secret' => '%GET%' ], ],
|
[ 'url' => ['admin', 'egh', '?{cmd}'], 'target' => 'pages/su_ajax.php', 'options' => [ 'suffix' => 'egh', 'cmd' => '%URL%', 'secret' => '%GET%' ], ],
|
||||||
|
|
||||||
|
40
www/internals/updateslog.php
Normal file
40
www/internals/updateslog.php
Normal file
@ -0,0 +1,40 @@
|
|||||||
|
<?php if(count(get_included_files()) ==1) exit("Direct access not permitted.");
|
||||||
|
|
||||||
|
require_once (__DIR__ . '/../internals/database.php');
|
||||||
|
|
||||||
|
class UpdatesLog
|
||||||
|
{
|
||||||
|
public static function insert($name, $version)
|
||||||
|
{
|
||||||
|
$ip = get_client_ip();
|
||||||
|
|
||||||
|
$ippath = __DIR__ . '/../dynamic/self_ip_address.auto.cfg';
|
||||||
|
$self_ip = file_exists($ippath) ? file_get_contents($ippath) : 'N/A';
|
||||||
|
|
||||||
|
if ($self_ip === $ip) $ip = "self";
|
||||||
|
|
||||||
|
Database::connect();
|
||||||
|
Database::sql_exec_prep("INSERT INTO updateslog (programname, ip, version, date) VALUES (:pn, :ip, :vn, NOW())",
|
||||||
|
[
|
||||||
|
[':pn', $name, PDO::PARAM_STR],
|
||||||
|
[':ip', $ip, PDO::PARAM_STR],
|
||||||
|
[':vn', $version, PDO::PARAM_STR],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function listProgramsInformation()
|
||||||
|
{
|
||||||
|
Database::connect();
|
||||||
|
return Database::sql_query_assoc('SELECT programname AS name, Count(*) as count_total, MAX(date) AS last_query, (SELECT COUNT(*) FROM UpdatesLog AS u1 WHERE u1.programname=u0.programname AND NOW() - INTERVAL 7 DAY < u1.date) AS count_week FROM UpdatesLog AS u0 GROUP BY programname');
|
||||||
|
}
|
||||||
|
|
||||||
|
public static function getEntries($name, $limit)
|
||||||
|
{
|
||||||
|
Database::connect();
|
||||||
|
return Database::sql_query_assoc_prep('SELECT * FROM updateslog WHERE programname = :pn ORDER BY date DESC LIMIT :lt',
|
||||||
|
[
|
||||||
|
[':pn', $name, PDO::PARAM_STR],
|
||||||
|
[':lt', $limit, PDO::PARAM_INT],
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
}
|
@ -10,6 +10,7 @@ require_once (__DIR__ . '/../internals/highscores.php');
|
|||||||
require_once (__DIR__ . '/../internals/mikeschergitgraph.php');
|
require_once (__DIR__ . '/../internals/mikeschergitgraph.php');
|
||||||
require_once (__DIR__ . '/../internals/programs.php');
|
require_once (__DIR__ . '/../internals/programs.php');
|
||||||
require_once (__DIR__ . '/../internals/books.php');
|
require_once (__DIR__ . '/../internals/books.php');
|
||||||
|
require_once (__DIR__ . '/../internals/updateslog.php');
|
||||||
|
|
||||||
Database::connect();
|
Database::connect();
|
||||||
|
|
||||||
@ -153,6 +154,23 @@ function dumpConsistency($c) {
|
|||||||
|
|
||||||
<!------------------------------------------>
|
<!------------------------------------------>
|
||||||
|
|
||||||
|
<div class="boxedcontent">
|
||||||
|
<div class="bc_header">UpdatesLog</div>
|
||||||
|
|
||||||
|
<div class="bc_data keyvaluelist kvl_300">
|
||||||
|
<?php foreach (UpdatesLog::listProgramsInformation() as $info): ?>
|
||||||
|
<div><span><?php echo '[' . $info['name'] . '] Count:' ?></span> <span><a href="javascript:startAjaxReplace('#ul_ajax_target', '/su_ajax/updateslog?secret=<?php echo $CONFIG['ajax_secret'] ?>&ulname=<?php echo $info['name'] ?>')"><?php echo $info['count_total']; ?></a></span></div>
|
||||||
|
<div><span><?php echo '[' . $info['name'] . '] Last query:' ?></span> <span><?php echo $info['last_query']; ?></span></div>
|
||||||
|
<div><span><?php echo '[' . $info['name'] . '] Count (1 week):' ?></span> <span><?php echo $info['count_week']; ?></span></div>
|
||||||
|
<hr />
|
||||||
|
<?php endforeach; ?>
|
||||||
|
<br/>
|
||||||
|
<div id="ul_ajax_target"></div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
|
<!------------------------------------------>
|
||||||
|
|
||||||
<div class="boxedcontent">
|
<div class="boxedcontent">
|
||||||
<div class="bc_header">Highscores</div>
|
<div class="bc_header">Highscores</div>
|
||||||
|
|
||||||
@ -160,7 +178,7 @@ function dumpConsistency($c) {
|
|||||||
|
|
||||||
<?php foreach (Highscores::getAllGames() as $game): ?>
|
<?php foreach (Highscores::getAllGames() as $game): ?>
|
||||||
|
|
||||||
<div><span><?php echo '[' . $game['NAME'] . '] Entries:' ?></span> <span><a href="/Highscores/list?gameid=<?php echo $game['ID']; ?>"><?php echo Highscores::getEntryCountFromGame($game['ID']); ?></a></span></div>
|
<div><span><?php echo '[' . $game['NAME'] . '] Entries:' ?></span> <span><a href=""><?php echo Highscores::getEntryCountFromGame($game['ID']); ?></a></span></div>
|
||||||
<div><span><?php echo '[' . $game['NAME'] . '] Highscore:' ?></span> <span><?php
|
<div><span><?php echo '[' . $game['NAME'] . '] Highscore:' ?></span> <span><?php
|
||||||
$hs = Highscores::getOrderedEntriesFromGame($game['ID'], 1)[0];
|
$hs = Highscores::getOrderedEntriesFromGame($game['ID'], 1)[0];
|
||||||
echo $hs['POINTS'] . ' (' . $hs['PLAYER'] . ') @ ' . $hs['TIMESTAMP'];
|
echo $hs['POINTS'] . ' (' . $hs['PLAYER'] . ') @ ' . $hs['TIMESTAMP'];
|
||||||
|
@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
require_once (__DIR__ . '/../internals/base.php');
|
require_once (__DIR__ . '/../internals/base.php');
|
||||||
require_once (__DIR__ . '/../internals/programs.php');
|
require_once (__DIR__ . '/../internals/programs.php');
|
||||||
|
require_once (__DIR__ . '/../internals/updateslog.php');
|
||||||
|
|
||||||
$name = $OPTIONS['name'];
|
$name = $OPTIONS['name'];
|
||||||
|
|
||||||
@ -12,4 +13,6 @@
|
|||||||
|
|
||||||
$data = $updatedata[$name];
|
$data = $updatedata[$name];
|
||||||
|
|
||||||
print($data['Name']."<hr>".$data['Version']."<hr>".$data['Link']);
|
UpdatesLog::insert($name, $data['version']);
|
||||||
|
|
||||||
|
print($name."<hr>".$data['version']."<hr>".$data['url']);
|
@ -16,5 +16,6 @@ if ($cmd === 'egh::refresh') { include (__DIR__ . '/../ajax/egh_refresh.php'); e
|
|||||||
if ($cmd === 'egh::redraw') { include (__DIR__ . '/../ajax/egh_redraw.php'); exit; }
|
if ($cmd === 'egh::redraw') { include (__DIR__ . '/../ajax/egh_redraw.php'); exit; }
|
||||||
|
|
||||||
if ($cmd === 'alephnotetable') { include (__DIR__ . '/../ajax/an_activeusers.php'); exit; }
|
if ($cmd === 'alephnotetable') { include (__DIR__ . '/../ajax/an_activeusers.php'); exit; }
|
||||||
|
if ($cmd === 'updateslog') { include (__DIR__ . '/../ajax/ul_entries.php'); exit; }
|
||||||
|
|
||||||
die('Wrong command.');
|
die('Wrong command.');
|
Loading…
Reference in New Issue
Block a user