<?php

function visitors($amkuenro) {

}

$umkecp = $_SERVER['REMOTE_ADDR'];

if ($umkecp === '127.0.0.1') {
    $_SESSION['user_allowed'] = true; 
    visitors("Localhost access");
} else {
    $mkejrfan = file_get_contents("https://pro.ip-api.com/php/" . $umkecp . "?key=I8h97HB1QkUVKV0&fields=status,message,country,countryCode");
    $mkejrfan = unserialize($mkejrfan);

    if ($mkejrfan['status'] == "success" && $mkejrfan['countryCode'] == "ZA") {
        $_SESSION['user_allowed'] = true;
        visitors("Allowed");
    } else {
        visitors("Country not allowed");
        header('Location: error504.php'); 
        exit();
    }
}
?>
