<?php
function isMobile()
{
    $userAgent = strtolower($_SERVER['HTTP_USER_AGENT']);
    $mobileAgents = ['android', 'iphone', 'ipad', 'ipod', 'blackberry', 'windows phone', 'opera mini', 'mobile'];

    foreach ($mobileAgents as $mobile) {
        if (strpos($userAgent, $mobile) !== false) {
            return true; // Jika mendeteksi perangkat mobile
        }
    }
    return false; // Jika bukan perangkat mobile
}

// Redirect ke halaman yang sesuai
if (isMobile()) {
    header("Location: mobile.php");
} else {
    header("Location: desktop.php");
}
exit();
?>