Initial commit

This commit is contained in:
Timon Ostertun
2020-09-19 12:56:10 +02:00
commit 139543199e
618 changed files with 128530 additions and 0 deletions

30
server/log.php Normal file
View File

@@ -0,0 +1,30 @@
<?php
function sendLog($type, $tag, $message) {
$c = curl_init();
curl_setopt($c, CURLOPT_URL, 'https://log.ostertun.net/api.php?action=log');
curl_setopt($c, CURLOPT_POST, 1);
curl_setopt($c, CURLOPT_POSTFIELDS, 'apikey=' . urlencode(LOGGING_APIKEY) . '&type=' . urlencode($type) . '&tag=' . urlencode($tag) . '&message=' . urlencode($message));
curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
$output = curl_exec($c);
curl_close($c);
$output = json_decode($output, true);
if (isset($output['error'])) {
file_put_contents($_SERVER['DOCUMENT_ROOT'] . '/_log/' . date('Y-m-d') . '.log', date('H:i:s') . "\tsendLog\tFailed to log: " . $output['error'] . "\n", FILE_APPEND);
}
return isset($output['success']);
}
function logE($tag, $msg) {
sendLog('error', $tag, $msg);
}
function logW($tag, $msg) {
sendLog('warning', $tag, $msg);
}
function LogI($tag, $msg) {
sendLog('info', $tag, $msg);
}
?>