summaryrefslogtreecommitdiff
path: root/telemetry/private/dom.php
blob: 4519e79e491a62db5a4efdf509b6969a708e3d20 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php

$db = json_decode(file_get_contents("/mnt/minteckrolt-main/includes/telemetry.json"), true);

$ip = md5($_SERVER['REMOTE_ADDR']);
$day = date('d');
$month = date('m');
$year = date('y');
$url = "kartik:" .explode("?", $_SERVER['REQUEST_URI'])[0];

if (!isset($db[$year]) && $_SERVER['PHP_SELF'] !== "/error.php") {
    $db[$year] = [];
}
if (!isset($db[$year][$month]) && $_SERVER['PHP_SELF'] !== "/error.php") {
    $db[$year][$month] = [];
}
if (!isset($db[$year][$month][$day]) && $_SERVER['PHP_SELF'] !== "/error.php") {
    $db[$year][$month][$day] = [];
}
if (!isset($db[$year][$month][$day][$url]) && $_SERVER['PHP_SELF'] !== "/error.php") {
    $db[$year][$month][$day][$url] = [];
}

if (!in_array($ip, $db[$year][$month][$day][$url]) && $_SERVER['PHP_SELF'] !== "/error.php") {
    array_push($db[$year][$month][$day][$url], $ip);
}

if (trim(json_encode($db, JSON_PRETTY_PRINT)) !== "null") {
    file_put_contents("/mnt/minteckrolt-main/includes/telemetry.json", json_encode($db, JSON_PRETTY_PRINT));
}