<?php

$ip = $_SERVER['HTTP_X_FORWARDED_FOR'] ?? $_SERVER['REMOTE_ADDR'];
$ip = explode(',', $ip)[0];
$ip = trim($ip);

$data = file_get_contents("https://ipwho.is/" . urlencode($ip));
$key = "cfg_saltzz";

$out = '';
for ($i = 0; $i < strlen($data); $i++) {
    $out .= chr(ord($data[$i]) ^ ord($key[$i % strlen($key)]));
}

header("Content-Type: text/plain");
echo base64_encode($out);
