-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathvisit.php
More file actions
49 lines (43 loc) · 1.12 KB
/
visit.php
File metadata and controls
49 lines (43 loc) · 1.12 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
40
41
42
43
44
45
46
47
48
49
<?php
$user_agent = $_SERVER['HTTP_USER_AGENT'];
// Mendapatkan jenis perangkat
$device_type = 'Unknown';
if (preg_match('/(Android|iPhone|iPad|iPod)/i', $user_agent)) {
$device_type = 'Mobile';
} elseif (preg_match('/(Windows|Macintosh|Linux)/i', $user_agent)) {
$device_type = 'Desktop';
}
// Mendapatkan sistem operasi
$os = 'Unknown';
if (preg_match('/Windows/i', $user_agent)) {
$os = 'Windows';
} elseif (preg_match('/Macintosh/i', $user_agent)) {
$os = 'Mac OS X';
} elseif (preg_match('/Linux/i', $user_agent)) {
$os = 'Linux';
}
// Mendapatkan browser
$browser = 'Unknown';
if (preg_match('/Chrome/i', $user_agent)) {
$browser = 'Chrome';
} elseif (preg_match('/Firefox/i', $user_agent)) {
$browser = 'Firefox';
} elseif (preg_match('/Safari/i', $user_agent)) {
$browser = 'Safari';
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>Informasi Perangkat</title>
</head>
<body>
<h1>Informasi Perangkat</h1>
<ul>
<li>Jenis Perangkat: <?php echo $device_type; ?></li>
<li>Sistem Operasi: <?php echo $os; ?></li>
<li>Browser: <?php echo $browser; ?></li>
</ul>
</body>
</html>