HEX
Server: Apache
System: Linux vps.teamads.com 4.18.0-553.126.1.el8_10.x86_64 #1 SMP Thu May 28 06:44:09 EDT 2026 x86_64
User: teamadsc (1024)
PHP: 8.1.34
Disabled: NONE
Upload Files
File: /home/teamadsc/public_html/wp-content/plugins/visitors/geoip/admin/build_geoipregionvars.php
#!/usr/bin/php -q
<?php

function downloadAndOpen($url)
{
    $file = basename($url);
    if (!file_exists(sprintf('%s/%s', __DIR__, $file))) {
        $ch = curl_init();
        $timeout = 5;
        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
        $data = curl_exec($ch);
        curl_close($ch);
        file_put_contents($file, $data);
    }
    return file($file);
}

$countries = downloadAndOpen('https://www.maxmind.com/download/geoip/misc/region_codes.csv');

$array = array();
foreach ($countries as $line) {
    $datas = explode(',', $line);
    $array[$datas[0]][trim(preg_replace('/"/im', '', $datas[2]))] = sprintf("%s", $datas[1]);
}
$array = array_map('array_flip', $array);
//date_default_timezone_set(date_default_timezone_get());
//date_default_timezone_set("UTC");
$output = "<?php\n";
$output .= sprintf("// Copyright %s MaxMind, Inc. All Rights Reserved\n", ahcpro_localtime('Y'));
$output .= "global \$GEOIP_REGION_NAME;\n";
$output .= "\$GEOIP_REGION_NAME = " . var_export($array, true) . ";\n";

file_put_contents(__DIR__ . '/../src/geoipregionvars.php', $output);