-
Notifications
You must be signed in to change notification settings - Fork 7
Expand file tree
/
Copy pathtrack.php
More file actions
32 lines (27 loc) · 836 Bytes
/
track.php
File metadata and controls
32 lines (27 loc) · 836 Bytes
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
31
32
<?php
/**
* DeepSID
*
* Track a behavior on the web site.
*/
require_once("class.account.php"); // Includes setup
if (!isset($_SERVER['HTTP_X_REQUESTED_WITH']) || $_SERVER['HTTP_X_REQUESTED_WITH'] != 'XMLHttpRequest')
die("Direct access not permitted.");
// @todo Check again if this works:
if ($account->CheckLogin() && ($account->UserName() == 'JCH' || $account->UserName() == 'Ratings'))
exit();
try {
$db = $account->GetDB();
$insert = $db->prepare('
INSERT INTO tracking (event_type, target, ip, created_at)
VALUES (:type, :target, :ip, NOW())
');
$insert->execute([
':type' => $_POST['type'] ?? 'unknown',
':target' => $_POST['target'] ?? null,
':ip' => $_SERVER['REMOTE_ADDR'],
]);
} catch (Exception $e) {
// Silently fail, don't echo to user
}
?>