1
0

api/stats

This commit is contained in:
Mike Schwörer 2017-12-04 17:45:10 +01:00
parent a25b5b7662
commit 94ed85f681
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
2 changed files with 44 additions and 0 deletions

View File

@ -32,6 +32,7 @@ $URL_RULES =
[ 'url' => ['api', 'update', '?{Name}'], 'target' => 'pages/api_updatecheck.php', 'options' => [ 'Name' => '%URL%' ], ],
[ 'url' => ['api', 'test'], 'target' => 'pages/api_test.php', 'options' => [], ],
[ 'url' => ['api', 'setselfadress'], 'target' => 'pages/api_setselfadress.php', 'options' => [], ],
[ 'url' => ['api', 'statsping'], 'target' => 'pages/api_stats.php', 'options' => [ 'Name' => '%GET%', 'ClientID' => '%GET%', 'Version' => '%GET%', 'ProviderStr' => '%GET%', 'ProviderID' => '%GET%', 'NoteCount' => '%GET%', ], ],
[ 'url' => ['msmain', 'admin', 'egh', '?{commandcode}'], 'target' => 'pages/admin_egh.php', 'options' => [ 'commandcode' => '%URL%' ], ],
[ 'url' => ['msmain', 'adminEGH'], 'target' => 'pages/admin_egh.php', 'options' => [ 'commandcode' => '%GET%' ], ],
@ -129,3 +130,14 @@ foreach ($URL_RULES as $rule)
include 'pages/error_404.php';
return;
}
//TODO printed books 2 hp
//TODO programs (sort out)
//TODO befunge runner for bef-blog + euler
//TODO fast
//TODO gzip (?)
//TODO better gh widget

32
www/pages/api_stats.php Normal file
View File

@ -0,0 +1,32 @@
<?php
global $OPTIONS;
require_once (__DIR__ . '/../internals/base.php');
require_once (__DIR__ . '/../internals/database.php');
$nam = $OPTIONS['Name'];
$cid = $OPTIONS['ClientID'];
$ver = $OPTIONS['Version'];
$prv = $OPTIONS['ProviderStr'];
$pid = $OPTIONS['ProviderID'];
$tnc = $OPTIONS['NoteCount'];
if ($nam === 'AlephNote')
{
Database::connect();
Database::sql_exec_prep('REPLACE INTO ms4_an_statslog (ClientID, Version, ProviderStr, ProviderID, NoteCount) VALUES (:cid, :ver, :prv, :pid, :tnc)',
[
[':cid', $cid, PDO::PARAM_STR],
[':ver', $ver, PDO::PARAM_STR],
[':prv', $prv, PDO::PARAM_STR],
[':pid', $pid, PDO::PARAM_STR],
[':tnc', $tnc, PDO::PARAM_INT],
]);
print('{"success":true}');
}
else
{
print('{"success":false, "message":"Unknown AppName"}');
}