1
0

api/statsping

This commit is contained in:
Mike Schwörer 2017-12-04 17:25:37 +01:00
parent b4d821fba6
commit 05a1b5e289
Signed by: Mikescher
GPG Key ID: D3C7172E0A70F8CF
2 changed files with 34 additions and 0 deletions

View File

@ -65,6 +65,36 @@ class APIController extends MSController
$this->render('update', ['data' => $data]); $this->render('update', ['data' => $data]);
} }
public function actionStatsPing()
{
if (! isset($_GET['Name'])) { throw new CHttpException(404,'Invalid Request'); return; }
if (! isset($_GET['ClientID'])) { throw new CHttpException(404,'Invalid Request'); return; }
if (! isset($_GET['Version'])) { throw new CHttpException(404,'Invalid Request'); return; }
if (! isset($_GET['ProviderStr'])) { throw new CHttpException(404,'Invalid Request'); return; }
if (! isset($_GET['ProviderID'])) { throw new CHttpException(404,'Invalid Request'); return; }
if (! isset($_GET['NoteCount'])) { throw new CHttpException(404,'Invalid Request'); return; }
if ($_GET['Name'] == 'AlephNote')
{
$connection = Yii::app()->db;
$command=$connection->createCommand("REPLACE INTO {{an_statslog}} (ClientID, Version, ProviderStr, ProviderID, NoteCount) VALUES (:cid, :v, :pstr, :pid, :nc)");
$command->bindValues([
':cid' => $_GET['ClientID'],
':v' => $_GET['Version'],
':pstr' => $_GET['ProviderStr'],
':pid' => $_GET['ProviderID'],
':nc' => $_GET['NoteCount'],
]);
$command->query();
$this->render('stats', ['out' => '{"success":true}']);
}
else
{
$this->render('stats', ['out' => '{"success":false}']);
}
}
public function actionSetSelfAdress() public function actionSetSelfAdress()
{ {
if (! isset($_GET['ip'])) { if (! isset($_GET['ip'])) {

View File

@ -0,0 +1,4 @@
<?php
/* @var $this APIController */
print($out);