HEX
Server: Apache/2.4.57 (Ubuntu) mod_fcgid/2.3.9 OpenSSL/3.0.2
System: Linux vmi267337.contaboserver.net 5.15.0-25-generic #25-Ubuntu SMP Wed Mar 30 15:54:22 UTC 2022 x86_64
User: ohirex (1008)
PHP: 8.2.8
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,exec,system,passthru,shell_exec
Upload Files
File: /home/ohirex/web/ohirex.com/public_html/join/bases/ipcountry.php
<?php
require_once __DIR__.'/geoip2.phar';
use GeoIp2\Database\Reader;

function getip(){
	if (!isset($ipfound)){
        if (isset($_SERVER['HTTP_CF_CONNECTING_IP']))
			//echo 'Cloud';
            $ipfound = $_SERVER['HTTP_CF_CONNECTING_IP'];
    }

	if (!isset($ipfound)){
		if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
			//echo 'Client';
			$ipfound = $_SERVER['HTTP_CLIENT_IP'];
		}
	}

	if(!isset($ipfound)){
		if(isset($_SERVER['HTTP_X_FORWARDED_FOR']) && !empty($_SERVER['HTTP_X_FORWARDED_FOR'])){
			//echo 'Forward';
			$ip=$_SERVER['HTTP_X_FORWARDED_FOR'];
			$ip=explode(", ", $ip);
			if(count($ip)<=1){$ip=explode(",", $ip[0]);}
			if(!empty($ip[0])){
				$ipfound=$ip[0];
			}
		}
	}

	if(!isset($ipfound)){
		if(isset($_SERVER['REMOTE_ADDR'])){
			//echo 'Remote';
			$ipfound=$_SERVER['REMOTE_ADDR'];
		}
	}

	if (!isset($ipfound))
		$ipfound='Unknown';
	if ($ipfound==='::1'||$ipfound==='127.0.0.1') $ipfound='2001:0db8:0000:0000:0000:ff00:0042:8329'; //for debugging
	return $ipfound;
}

function getcountry($ip=null){
	if (is_null($ip))
		$ip=getip();
	$reader = new Reader(__DIR__.'/GeoLite2-Country.mmdb');
	if ($ip==='::1'||$ip==='127.0.0.1') $ip='31.177.76.70'; //for debugging
	try{
        $record = $reader->country($ip);
        return $record->country->isoCode;
    }
	catch (GeoIp2\Exception\AddressNotFoundException $exception)
    {
		return 'Unknown';
    }
}

function getcity($ip,$locale){
	$reader = new Reader(__DIR__.'/GeoLite2-City.mmdb');
	if ($ip==='::1'||$ip==='127.0.0.1') $ip='31.177.76.70'; //for debugging
	try{
        $record = $reader->city($ip);
        if (array_key_exists($locale,$record->city->names))
            return $record->city->names[$locale];
        else
            return $record->city->name;
    }
	catch (GeoIp2\Exception\AddressNotFoundException $exception)
    {
    	return 'Unknown';
    }
}

function getisp($ip){
	$reader = new Reader(__DIR__.'/GeoLite2-ASN.mmdb');
	if ($ip==='::1'||$ip==='127.0.0.1') $ip='31.177.76.70'; //for debugging
	try{
        $record = $reader->asn($ip);
        return $record->autonomousSystemOrganization;
    }
	catch (GeoIp2\Exception\AddressNotFoundException $exception)
    {
    	return 'Unknown';
    }
}
?>