-
Notifications
You must be signed in to change notification settings - Fork 57
/
Copy pathsummaryBrowsersCard.php
48 lines (44 loc) · 4.24 KB
/
summaryBrowsersCard.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
44
45
46
47
48
<?php
require __DIR__ . '/vendor/autoload.php';
include_once __DIR__ . '/inc/browsers.inc.php';
include_once __DIR__ . '/inc/browserGeo.inc.php';
?>
<?php
$hookedBrowsersList = getHookedBrowsers($pdo);
if(isset($hookedBrowsersList) && !empty($hookedBrowsersList)) {
foreach ($hookedBrowsersList as $hookedBrowser) {
$ua_info = parse_user_agent($hookedBrowser['user_agent']);
$geoloc = getGeoloc($pdo, $hookedBrowser['browser_id'], $hookedBrowser['public_ip']);
if(isset($hookedBrowser['browser_id']) && !empty($hookedBrowser['browser_id'])) {
?>
<tr>
<td class="bg-transparent text-light text-center align-middle p-1"><a href="browserDetails.php?browserId=<?php echo htmlspecialchars($hookedBrowser['browser_id']) ?>&page=overview" class="clientID"><?php echo htmlspecialchars($hookedBrowser['browser_id']) ?></a></td>
<td class="bg-transparent align-middle p-1"><img src="./images/<?php echo (isAlive($hookedBrowser['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($hookedBrowser['last_heartbeat']))) ?>"><?php echo htmlspecialchars(strtotime($hookedBrowser['last_heartbeat']) !== false ? date("d/m/Y H:i:s", strtotime($hookedBrowser['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($hookedBrowser['hooked_date']))) ?>"><?php echo htmlspecialchars(strtotime($hookedBrowser['hooked_date']) !== false ? date("d/m/Y H:i:s", strtotime($hookedBrowser['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(isset($ua_info['version']) && !empty($ua_info['version']) ? $ua_info['version'] : 'N/A') ?></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(isset($hookedBrowser['public_ip']) && !empty($hookedBrowser['public_ip']) ? $hookedBrowser['public_ip'] : 'N/A') ?></td>
<td class="bg-transparent text-light text-center align-middle p-1"><?php echo htmlspecialchars(isset($hookedBrowser['hostname']) && !empty($hookedBrowser['hostname']) ? $hookedBrowser['hostname'] : 'N/A') ?></td>
<td class="bg-transparent text-light text-center align-middle p-1">
<a class="btn btn-light shadow-none ui-action-icons-details p-1" href="browserDetails.php?browserId=<?php echo htmlspecialchars($hookedBrowser['browser_id']) ?>&page=overview" role="button"><i class="bi bi-search"></i></a>
<form action="index.php" method="POST" style="display:inline;" onsubmit="return confirmDelete();">
<input type="hidden" name="delete" value="<?php echo htmlspecialchars($hookedBrowser['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>