tools/.hta_slug/what-is-my-device.php

35 lines
1.1 KiB
PHP

<?php
function is_mobile_device() {
$user_agent = $_SERVER['HTTP_USER_AGENT'];
$mobile_keywords = array('android', 'iphone', 'ipod', 'blackberry', 'opera mini', 'windows phone', 'iemobile');
foreach ($mobile_keywords as $keyword) {
if (stripos($user_agent, $keyword) !== false) {
return true;
}
}
return false;
}
if (is_mobile_device()) {
$device_name = "You're accessing from a mobile device.";
} else {
$device_name = "You're accessing from a desktop device.";
}
?>
<section class="container-zz mx-auto my-20">
<div style="font-size: 25px;">
<p>Your Device System:</p>
<h3><?php echo $device_name; ?></h3>
</div>
</section>
<style>
.container-zz{width:100%}@media (min-width: 640px){.container-zz{max-width:640px}}@media (min-width: 768px){.container-zz{max-width:768px}}@media (min-width: 1024px){.container-zz{max-width:1024px}}@media (min-width: 1280px){.container-zz{max-width:1280px}}@media (min-width: 1536px){.container-zz{max-width:1536px}}
.mx-auto{margin-left:auto;margin-right:auto}
.my-20{margin-top:5rem;margin-bottom:5rem}
</style>