-
Notifications
You must be signed in to change notification settings - Fork 57
/
Copy pathsummaryBrowserCard.php
43 lines (40 loc) · 3.41 KB
/
summaryBrowserCard.php
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
40
41
42
43
<?php
require __DIR__ . '/vendor/autoload.php';
include_once __DIR__ . '/inc/browsers.inc.php';
include_once __DIR__ . '/inc/browserSummary.inc.php';
include_once __DIR__ . '/inc/browserGeo.inc.php';
?>
<?php
$hookedBrowserDetails = getHookedBrowserDetails($pdo, $_GET['browserId']);
if($hookedBrowserDetails) {
$ua_info = parse_user_agent($hookedBrowserDetails['user_agent']);
$geoloc = getGeoloc($pdo, $_GET['browserId'], $hookedBrowserDetails['public_ip']);
?>
<tr>
<td class="bg-transparent text-light text-center align-middle p-1"><span id="browserId"><?php echo htmlspecialchars($hookedBrowserDetails['browser_id']) ?></span></td>
<td class="bg-transparent align-middle p-1"><img src="images/<?php echo (isAlive($hookedBrowserDetails['last_heartbeat']) ? 'online' : 'offline') ?>_button.png" height="20" width="20"/></td>
<td class="bg-transparent text-light text-center align-middle p-1" data-utc="<?php echo htmlspecialchars(date("Y-m-d\TH:i:s\Z", strtotime($hookedBrowserDetails['last_heartbeat']))) ?>"><?php echo htmlspecialchars(strtotime($hookedBrowserDetails['last_heartbeat']) !== false ? date("d/m/Y H:i:s", strtotime($hookedBrowserDetails['last_heartbeat'])) : 'N/A') ?></td>
<td class="bg-transparent text-light text-center align-middle p-1" data-utc="<?php echo htmlspecialchars(date("Y-m-d\TH:i:s\Z", strtotime($hookedBrowserDetails['hooked_date']))) ?>"><?php echo htmlspecialchars(strtotime($hookedBrowserDetails['hooked_date']) !== false ? date("d/m/Y H:i:s", strtotime($hookedBrowserDetails['hooked_date'])) : 'N/A') ?></td>
<td class="bg-transparent align-middle p-1"><img src="./images/user_agent/platform/<?php echo htmlspecialchars(getPlatformIcon($ua_info['platform'])) . '.png' ?>" height="20" width="20" title="<?php echo htmlspecialchars($ua_info['platform']) ?>"/></td>
<td class="bg-transparent align-middle p-1"><img src="./images/user_agent/browser/<?php echo htmlspecialchars(getBrowserIcon($ua_info['browser'])) . '.png' ?>" height="20" width="20" title="<?php echo htmlspecialchars($ua_info['browser']) ?>"/></td>
<td class="bg-transparent text-light text-center align-middle p-1"><?php echo htmlspecialchars($ua_info['version']) ?></td>
<td class="bg-transparent align-middle p-1"><span class="fi fi-<?php echo htmlspecialchars(strtolower($geoloc['country_code'])) ?> fis" title="<?php echo htmlspecialchars($geoloc['country']) ?>"></span></td>
<td class="bg-transparent text-light text-center align-middle p-1"><?php echo htmlspecialchars($hookedBrowserDetails['public_ip']) ?></td>
<td class="bg-transparent text-light text-center align-middle p-1"><?php echo htmlspecialchars($hookedBrowserDetails['hostname']) ?></td>
<td class="bg-transparent text-light text-center align-middle p-1">
<form action="index.php" method="POST" style="display:inline;" onsubmit="return confirmDelete();">
<input type="hidden" name="delete" value="<?php echo htmlspecialchars($hookedBrowserDetails['browser_id']) ?>">
<button type="submit" class="btn btn-danger shadow-none ui-action-icons-delete p-1">
<i class="bi bi-trash"></i>
</button>
</form>
</td>
</tr>
<?php
}
?>
<script>
function confirmDelete() {
return confirm("Are you sure you want to delete this browser?");
}
</script>