1
0
www.mikescher.com/www/pages/api_stats.php

38 lines
1.0 KiB
PHP
Raw Normal View History

2017-12-04 17:45:10 +01:00
<?php
global $OPTIONS;
require_once (__DIR__ . '/../internals/base.php');
require_once (__DIR__ . '/../internals/database.php');
2018-02-03 17:53:25 +01:00
$nam = $OPTIONS['name'];
$cid = $OPTIONS['clientid'];
$ver = $OPTIONS['version'];
$prv = $OPTIONS['providerstr'];
$pid = $OPTIONS['providerid'];
$tnc = $OPTIONS['notecount'];
2017-12-04 17:45:10 +01:00
if ($nam === 'AlephNote')
{
Database::connect();
2018-02-07 19:04:03 +01:00
Database::sql_exec_prep('INSERT INTO an_statslog (ClientID, Version, ProviderStr, ProviderID, NoteCount) VALUES (:cid1, :ver1, :prv1, :pid1, :tnc1) ON DUPLICATE KEY UPDATE Version=:ver2,ProviderStr=:prv2,ProviderID=:pid2,NoteCount=:tnc2',
2017-12-04 17:45:10 +01:00
[
2018-02-07 19:04:03 +01:00
[':cid1', $cid, PDO::PARAM_STR],
[':ver1', $ver, PDO::PARAM_STR],
[':prv1', $prv, PDO::PARAM_STR],
[':pid1', $pid, PDO::PARAM_STR],
[':tnc1', $tnc, PDO::PARAM_INT],
[':ver2', $ver, PDO::PARAM_STR],
[':prv2', $prv, PDO::PARAM_STR],
[':pid2', $pid, PDO::PARAM_STR],
[':tnc2', $tnc, PDO::PARAM_INT],
2017-12-04 17:45:10 +01:00
]);
print('{"success":true}');
}
else
{
print('{"success":false, "message":"Unknown AppName"}');
}