<link rel="stylesheet" href="../css/layout.css" type="text/css" media="screen" />
<link rel="stylesheet" type="text/css" href="../css/demo.css"/>
<style>
  table.list{border:solid 1px #bbb;
border-collapse:collapse;}
table.list tr{}
table.list tr.odd td{background:#e8e8e8;}
table.list tr.even td{}table.list tr th{background:url(../images/list-header-bg.png) repeat-x;background-size:contain;color:white;border:solid 1px #ccc;padding:2px 4px;font-weight:normal;}
table.list tr td{background:white;border-left:solid 1px #ccc;padding:2px 4px;}
table.list tr:hover td{background:#E2F2FC;}
table.data-dark{border:solid 1px #ccc;}
table.data-dark tr td{padding:2px 16px;border-bottom:solid 1px #ccc;background:#eee;}
table.data-dark tr td:first-child{text-align:right;font-weight:bold;background:#555;color:#CCCCCC;}
#load{
position:absolute;
z-index:1;
font-size: 14px;
background-image:url(../images/loadingz.gif);
width:290px;
height:121px;
top:50%;
left:50%; 
margin-top: -104px;
  margin-left: -145px;
text-align:center;
line-height:300px;
font-family:"Trebuchet MS", verdana, arial,tahoma;
color:#FFF;
}
/*----------------------------------------------------------------------{ alert }--------------------------------------------------------------------------*/
.alert					{ margin:3px; padding:5px 10px 5px 35px; display:block; line-height:20px; font-family:Tahoma; background:#f5f5f5; border:1px solid; }
	.success			{ color:#00632e; border-color:#339933; background:#d1e8d2 url(../img/frontend/tick_circle.png) no-repeat 10px 7px; }
	.error				{ color:#820101; border-color:#dc1c1c; background:#facfcf url(../img/frontend/cross_circle.png) no-repeat 10px 7px; }
	.warning			{ color:#675100; border-color:#d4b64b; background:#fdefbd url(../img/frontend/exclamation.png) no-repeat 10px 7px; }
	.info				{ color:#00357b; border-color:#9dbfea; background:#d8e7fa url(../img/frontend/information.png) no-repeat 10px 7px; }
	.note				{ color:#4d4d4d; border-color:#bdbdbd; background:#f4f4f4 url(../img/frontend/notebook.png) no-repeat 10px 7px; }
.notification			{ cursor:pointer; }
/*-------------------------------------------------------------------{ Form }-----------------------------------------------------------------------*/
.form_style				{ line-height:normal; }
.form_style .row		{ margin:0; padding:10px; background:#fff; }
.form_style .row:nth-of-type(even)	{ background-color:#f8f8f9; }
.form_style .row label	{ display:block; float:left; margin:0; padding:0; width:40%; line-height:28px; font-weight:bold; }
.form_style .row span	{ display:block; float:left; position:relative; margin:0; padding:0; width:60%; line-height:20px; }
.form_style .row span select,
.form_style .row span textarea,
.form_style .row span input	{ margin:0; padding:5px; width:200px; color:#888; background:#fff; border:solid 1px #d4d8db;  }
.form_style .row span select:hover,
.form_style .row span textarea:hover,
.form_style .row span input:hover{ color:#9089a2; border:1px solid #c9c2d8; }
.form_style .row span select:focus,
.form_style .row span textarea:focus,
.form_style .row span input:focus{ background:#f5f3f9; color:#663399; border:1px solid #663399; box-shadow:inset 1px 1px 1px #ceccd1; }
.form_style .row span select	{ width:212px; }
.form_style .row span select option	{ padding:0 5px; }

.form_style .row input.submit	{ position:relative; margin:0 0 5px 0; padding:4px 10px; width:auto; color:#EFF4FA; text-shadow:1px 1px 1px #316395; text-align:center; 
								  font-family:Tahoma; font-size:12px; font-weight:bold; text-decoration:none; border:1px solid #316395; border-radius:3px; cursor:pointer;
								  background:#4684C1; box-shadow:inset 0px 0px 3px 1px #75A3D0, 0px 1px 2px 0px rgba(0,0,0,0.4); }
.form_style .row input.submit:hover	{ text-shadow:1px 1px 1px #3D79B6; border:1px solid #3C78B5; background:#6397CB; 
										  box-shadow:inset 0px 0px 3px 1px #8DB3D8, 0px 1px 2px 0px rgba(0,0,0,0.4); }
.form_style .row input.submit:active	{ color:#316395; text-shadow:1px 1px 1px #5991C8; border-color:#316395; 
										  box-shadow:inset 0px 0px 3px 1px #75A3D0, 0px 1px 2px 0px rgba(0,0,0,0.4); }
										  
										  
										  
										  
.form_style .row span.textError		{ left:215px; }
						  
/*-------------------------------------------------------------------{ Form table }-----------------------------------------------------------------------*/
.form_style						{ margin:20px 0; padding:0; width:100%; font-size:13px; }
.form_style fieldset			{ padding:0px; border:solid 1px #cac7cd; border-radius:3px; -moz-border-radius:3px;
								  -khtml-border-radius:3px; -webkit-border-bottom-radius:3px; }
.form_style fieldset legend 	{ color:#444444; border:solid 1px #cac7cd; margin-left:10px; padding:5px 15px; font-weight:bold; border-radius:3px; }

.form_style table				{ margin:0 auto; padding:0; width:100%; border:none; border-collapse:collapse; }
.form_style table tr.row2		{ background:#f4f4f5; }
.form_style table td			{ margin:0; padding:12px 5px; }
.form_style table td span		{ display:block; position:relative; }
.form_style table td label		{ padding:5px 0 0 0; display:block; font-weight:bold; }
.form_style table td input,
.form_style table td textarea, 
.form_style table td select		{ padding:3px 3px 4px 3px; width:190px; color:#888; background:#fff; border:solid 1px #d4d8db; }
.form_style table td input:hover,
.form_style table td textarea:hover, 
.form_style table td select:hover	{ color:#878a91; border:1px solid #878a91; }
.form_style table td input:focus,
.form_style table td textarea:focus, 
.form_style table td select:focus	{ background:#f5f3f9; color:#663399; border:1px solid #663399; box-shadow:inset 1px 1px 1px #ceccd1; }

.form_style table td input.submit	{ position:relative; margin:0 0 5px 0; padding:4px 10px; width:auto; color:#EFF4FA; text-shadow:1px 1px 1px #316395; text-align:center; 
									  font-family:Tahoma; font-size:12px; font-weight:bold; text-decoration:none; border:1px solid #316395; border-radius:3px; cursor:pointer;
									  background:#4684C1; box-shadow:inset 0px 0px 3px 1px #75A3D0, 0px 1px 2px 0px rgba(0,0,0,0.4); }
.form_style table td input.submit:hover	{ text-shadow:1px 1px 1px #3D79B6; border:1px solid #3C78B5; background:#6397CB; 
										  box-shadow:inset 0px 0px 3px 1px #8DB3D8, 0px 1px 2px 0px rgba(0,0,0,0.4); }
.form_style table td  input.submit:active	{ color:#316395; text-shadow:1px 1px 1px #5991C8; border-color:#316395; 
											  box-shadow:inset 0px 0px 3px 1px #75A3D0, 0px 1px 2px 0px rgba(0,0,0,0.4); }






.form_style table td textarea	{ width:300px; height:100px; }

.form_style span.textError		{ position:absolute; top:2px; left:200px; padding-left:7px; z-index:1; 
								  background:url(../img/frontend/span_error_bg2.png) no-repeat left center; }
.form_style span.textError p	{ margin:0; padding:3px 7px; line-height:normal; font-size:10px; color:#ccc; background:#000; 
								  background:rgba(0,0,0,0.9); border:1px solid #000; border-radius:3px; }
.form_style p					{ margin:0px; padding:0px; }
.notification					{ cursor:pointer; }
				
  </style>
<?php
ob_start();
(@include ('../dt_page/lic.php')) or die("<script>alert(\"You not have a license to use this script on this domain, Please contact www.primadesain.com to purchase a license.\");"."window.location = './index.php'</script>");
$lic=$license;if(!$lic){echo "<script>alert(\"You not have a license to use this script on this domain, Please contact www.primadesain.com to purchase a license.\");"."window.location = './index.php'</script>";}$svr=$_SERVER['SERVER_NAME'];$c=curl_init();curl_setopt($c,CURLOPT_URL,"http://www.primadesain.com/verifylicenses.php");curl_setopt($c,CURLOPT_TIMEOUT,30);curl_setopt($c,CURLOPT_POST,1);curl_setopt($c,CURLOPT_RETURNTRANSFER,1);$postfields='svr='.$svr.'&lic='.$lic;curl_setopt($c,CURLOPT_POSTFIELDS,$postfields);$result=curl_exec($c);if($result=="fail"){echo "<script>alert(\"You not have a license to use this script on this domain, Please contact www.primadesain.com to purchase a license.\");"."window.location = './index.php'</script>";die();}
if (basename($_SERVER['SCRIPT_FILENAME']) == basename(__FILE__)){
echo "<p align=center><br><br><br><br><br><br><font size=\"6\" color=\"#FF0000\">ILLEGAL ACCESS !!";
echo "<meta http-equiv=\"refresh\" content=\"2; url=../index.php\">";
exit();} 
?>
<?php // Your license key 
$server = $_SERVER['SERVER_NAME'];

$c = curl_init(); 
// Set the full url path to point to your verifyLicense.php on your server 
curl_setopt($c, CURLOPT_URL, "http://www.primadesain.com/verifydomains.php"); 
curl_setopt($c, CURLOPT_TIMEOUT, 30); 
curl_setopt($c, CURLOPT_POST, 1); 
curl_setopt($c, CURLOPT_RETURNTRANSFER, 1); 

$postfields = 'svr='.$server; 
curl_setopt($c, CURLOPT_POSTFIELDS, $postfields); 
$result = curl_exec($c); 

if ($result=="fail") { 
echo "<p style='font-family:Arial, Helvetica, sans-serif; margin-top:80px; font-size:16px; line-height:180%; letter-spacing:2px;' align='center'><img src='https://primadesain.com/images/block.png' width='90' height='90' /></br></br>You not have a license to use this script on this domain,<br>Please contact us to purchase a license.<br><strong><a href='http://www.primadesain.com'>www.primadesain.com</a></strong></p><br><p style='font-family:Arial, Helvetica, sans-serif; margin-top:30px; font-size:12px; line-height:180%; letter-spacing:2px;' align='center'>&copy; 2009 - ".date ("Y")." www.primadesain.com</p>";
die(); }
?>

<div class="wrapper" style="width:600px;">
<?php
	/* 
	############################[  <about> ] #######################
		S Name   ::       Inv-X Primadesain
		Update   ::       2013 � Primadesain.Com
		Author   ::       Agus Susanto S.kom
		Website  ::		  http://primadesain.com
		Contact  ::		  <primapc57@gmail.com> // +62 85228657360
	
	Primadesain melayani pembuatan website MLM dan Investasi
	( dengan sistem binary, trinary atau matrix dan matahari )
	juga menerima pembuatan website Iklan Baris, Website Profile,
	Reseller, Hyip, dll.
	############################[ </about> ] #######################
	*/
?>

<?php 
if (isset($_GET['do']) && $_GET['do'] == "payment") {
if(isset($_GET["iv"])){ $iv = $_GET["iv"]; }
$coe=base64_decode($iv);	


$query35 = "SELECT * FROM dataewalet3 WHERE kode='$coe'"; 
$result35 = mysql_query($query35);
$numzz1 = mysql_num_rows($result35);
$row35 = mysql_fetch_array($result35);
$statusx = $row35['status'];
		
if(!$numzz1){
	header("location: page.php?go=waletepay&iv=$iv&result=no_transaction");
	exit;
} else {		
		
if($statusx == 1){

	header("location: page.php?go=waletepay&iv=$iv&result=already_proccess");
	exit;
} else {
		
$jumlahe = anti_injection($_POST['jumlah']);
$userwalet = anti_injection($_POST['userwalet']);
$tujuan = anti_injection($_POST['tujuan']);
$accid = anti_injection($_POST['accid']);
$transkode = anti_injection($_POST['transkode']);
$prod = anti_injection($_POST['prod']);
 
 if (!isset($_SESSION)) {
             session_start();
             }
			 session_regenerate_id(true);

		
		
$pincods = md5($_POST['pincode']);	
$sqlc = mysql_query("SELECT * FROM pincode WHERE username='$user_session'");
$numc = mysql_num_rows($sqlc);
while($rowc = mysql_fetch_array($sqlc)){
$tgl = formatgl($rowc['tgl']);
$pin = $rowc['pin'];
$sts = $rowc['status'];
$lock = $rowc['locks'];
	}
	if(!$numc) {
	header("location: page.php?go=waletepay&iv=$iv&result=wrong_pin_none");
	exit;
} else {
if(!$pincods || $pincods <> $pin) {
	header("location: page.php?go=waletepay&iv=$iv&result=wrong_pin");
	exit;
} else {
if($lock == 1) {
	header("location: page.php?go=waletepay&iv=$iv&result=wrong_pin_lock");
exit;
	} else {
if($sts == 0) {
	header("location: page.php?go=waletepay&iv=$iv&result=wrong_pin_invalid");
	exit;
} else {	
		
		// Insert you code for processing the form here, e.g emailing the submission, entering it into a database. 
		$userwalet = anti_injection($_POST['userwalet']);
		//$passewalet = $_POST['passewalet'];
		//$passewalete = md5($passewalet);
		
		$sqlzzv = mysql_query("SELECT * FROM member WHERE username='".mysql_real_escape_string($userwalet)."'");
        $numzzv = mysql_num_rows($sqlzzv);
		$rwzzv=mysql_fetch_array($sqlzzv);
        $statusv = $rwzzv['status'];
		if (!$numzzv){
		 header("location: page.php?go=waletepay&iv=$iv&result=wrong_user");
	     exit;
		}else{
		//if ($statusv == 0){
		// header("location: ./page.php?go=wallets&result=wrong_user&co=$_SESSION[user]&pay=$_SESSION[pay]");
	    // exit;
		//}else{
		
		
		$sqlzz = mysql_query("SELECT * FROM ewalet WHERE username='".mysql_real_escape_string($userwalet)."'");
        $numzz = mysql_num_rows($sqlzz);
        $rwzz=mysql_fetch_array($sqlzz);
        $users = $rwzz['username'];
        $status = $rwzz['status'];
		if (!$numzz){
		 header("location: page.php?go=waletepay&iv=$iv&result=wrong_walet");
	     exit;
		}else{
	//	if ($status == 0){
	//	header("location: page.php?go=waletepay&iv=$iv&result=blocked");
	//  exit;
	//	}else{
		
		//$db->select("username", "ewalet", "username='".mysql_real_escape_string($userwalet)."' and password='".mysql_real_escape_string($passewalete)."'");
		//if ($db->num_rows() > 0) {
			
		$saldocwallete = $db->mycwalet($userwalet);
			 $pendingcwallete = $db->mycwaletpending($userwalet);
			 $saldoku = $saldocwallete-$pendingcwallete;
			
if($saldoku < $jumlahe){
header("location: page.php?go=waletepay&iv=$iv&result=insufficient");
	  exit;
		}else{

        $sa_ewalet = $saldoku;
		if($sa_ewalet < $jumlahe) {
header("location: page.php?go=waletepay&iv=$iv&result=insufficient");
	  exit;
		}else{
				
require_once '../lib/GoogleAuthenticator.php';
$authenticator = new PHPGangsta_GoogleAuthenticator();
$secret = $db->dataku("2fa", $userwalet);		
$website   = $webz2fa; 
$title     = $ttl2fa;
$tolerance = $tlrz2fa;			
$authgoogles=$db->dataku("authgoogle", $userwalet);
$code    = anti_injection($_POST['one_time_password']);	  
$result  = $authenticator->verifyCode($secret,$code,$tolerance);
if($googleauntentic == 1 && $authgoogles == 1 && !$result){
header("location: page.php?go=waletepay&iv=$iv&result=wrong_auth");
exit;
} else {				
			


		$email = $db->dataku("email", $users);
		$nama = $db->dataku("nama", $users);
		$alamat = $db->dataku("alamat", $users);
		$hp = $db->dataku("hp", $users);
		$jumlahdepone = rupiah($jumlahe);
		$trans_code = $coe;


	
$sblxx2=mysql_query("select kode, username, jumlah, uraian, tgl, status, paket, plan, profit, cycle, kontrak, siklus, cashback, getamount from dataewalet3 where kode='$coe'");
	    while($rows=mysql_fetch_row($sblxx2)) {
		$trans_code = $rows[0];
		$usere = $rows[1];
		$jumlah = $rows[2];
		$uraian = $rows[3];
		$plan = $rows[6];
		$profite = $rows[8];
		$cyclee = $rows[9];
		$planpaket = $rows[7];
		$kontrake = $rows[10];
		$siklus = $rows[11];
		$tgle = $rows[4];
		$cashback = $rows[12];
		$getamount = $rows[13];
		}	
	
		

$mid=$tujuan;
$tokens = substr(str_shuffle(str_repeat("4453B141119A06676420371112GEHDLPD8717497783C6255363423ABCYWTGEHDLPMBTEFWXVU96411241472162223777", 24)), 0, 11);
$tokens2 = substr(str_shuffle(str_repeat("4453B255363423ABCYWTGEHDLPMBTEFWXVU96411241472162223777141119A06676420371112GEHDLPD8717497783C6", 36)), 0, 11);

$expired = date('Y-m-d H:i:s', strtotime("+".$kontrake." ".$siklus.""));
$spnex = $db->dataku("sponsor", $usere);

$pakete="Package ".$planpaket."";
$harine2 = date("N");


  $ttlprofite=($kontrake/100)*$jumlah;
		
			$db->update("dataewalet3", "status='1', tgl='$clientdate', exp='$clientdate'", "kode='$trans_code'");
			$db->update("reinv", "status='1'", "username='$usere'");
			
				$db->update("member", "harga='$plan', stage='$pringkate', sto='1', act='1'", "username='$usere'");
			
			
		$cekadadepo = mysql_query("select * from deposit where kode='$trans_code'");
$ada_deponec = mysql_num_rows($cekadadepo); 
if(!$ada_deponec) {	
			$db->insert("deposit", "", "'', '$usere', '$trans_code', '$jumlah', '1', '$clientdate', '$expired', '$plan', '$planpaket', '$profite', '$kontrake', '$harine2', '$siklus', '$ttlprofite', '$kontrake'"); 
			
}
			
	$cekadane = mysql_query("select kode from datacwalet where kode='$trans_code' and username='$usere'");
$ada_adane = mysql_num_rows($cekadane); 
if(!$ada_adane) {
	//$db->insert("datacwalet", "", "'', '".$trans_code."cb', 'administrator', '$cashback', 'Cashback Investment $kode $planpaket', '$usere', '$clientdate', 1, '$clientdate', '', ''");	
			$db->insert("datacwalet", "", "'', '$trans_code', '$usere', '$jumlah', 'Payment of investment package (user: $tujuan)', 'administrator', '$clientdate', 1, '$clientdate', '$accid', 'administrator'"); }
				
				
				
			//$jumlahe=$jumlah;
			$users=$usere;
			$username=$usere;
			$amount=$jumlah;
			$kode=$trans_code;
				
				
				
			$sponsore = $db->dataku("sponsor", $username);
			$sponsorelev1 = $db->dataku("sponsor", $sponsore);
			$sponsorelev2 = $db->dataku("sponsor", $sponsorelev1);
			$sponsorelev3 = $db->dataku("sponsor", $sponsorelev2);	
			$sponsorelev4 = $db->dataku("sponsor", $sponsorelev3);	
			$sponsorelev5 = $db->dataku("sponsor", $sponsorelev4);	
							
			$kmspons = ($db->config("komisi_sponsor")/100)*$amount;
			$kmspass = ($db->config("kompasangan")/100)*$amount;
			
			$kmsmtchz = explode("|", $db->config("matching"));	
			$komatchh1 = ($kmsmtchz[0]/100)*$amount;
			$komatchh2 = ($kmsmtchz[1]/100)*$amount;
			$komatchh3 = ($kmsmtchz[2]/100)*$amount;
			$komatchh4 = ($kmsmtchz[3]/100)*$amount;	
			$komatchh5 = ($kmsmtchz[4]/100)*$amount;				
			
			$ksp_towalletusd=($bonustowlusd/100)*$kmspons;
			$ksp_towalletstr=($bonustowlstore/100)*$kmspons;	
			
			$kpass_towalletusd=($bonustowlusd/100)*$kmspass;
			$kpass_towalletstr=($bonustowlstore/100)*$kmspass;	
			
			$kmtch1_towalletusd=($bonustowlusd/100)*$komatchh1;
			$kmtch1_towalletstr=($bonustowlstore/100)*$komatchh1;	
			
			$kmtch2_towalletusd=($bonustowlusd/100)*$komatchh2;
			$kmtch2_towalletstr=($bonustowlstore/100)*$komatchh2;
			
			$kmtch3_towalletusd=($bonustowlusd/100)*$komatchh3;
			$kmtch3_towalletstr=($bonustowlstore/100)*$komatchh3;
			
			$kmtch4_towalletusd=($bonustowlusd/100)*$komatchh4;
			$kmtch4_towalletstr=($bonustowlstore/100)*$komatchh4;
			
			$kmtch5_towalletusd=($bonustowlusd/100)*$komatchh5;
			$kmtch5_towalletstr=($bonustowlstore/100)*$komatchh5;
							
							
			if($sponsore && $kmspons > 0) {  
					$db->insert("komisi", "", "'', '$sponsore', '$kmspons', '$clientdate', '0', '', 'komsponsor', '$username', '".$kode."sp', ''");
					$db->insert("datacwalet", "", "'', '".$kode."sp', 'administrator', '$kmspons', 'Refferal Bonus From $username', '$sponsore', '$clientdate', 1, '$clientdate', '', ''");
				}
			   
			
		
			
			    
			$tgl_skrg = (date("Y-m-d"));
			$dtfrome = "$tgl_skrg 00:00:00";
			$dttoe = "$tgl_skrg 23:59:59";
			for($i=0;$i<100;$i++) {
					$upli = $db->dataupline("upline$i", $usere);
					$matchnow=$db->cocokpass($upli);
					$uql = mysql_query("select username from komisi where jenis='kompasangan' and username='$upli'"); 
					$match = mysql_num_rows($uql);
					$usp = explode("-", $upli);
					$sql_fo = mysql_query("select username from komisi where jenis='kompasangan' and username='$usp[0]' and (tglbayar between '$dtfrome' and '$dttoe')");
					$ada_fo = mysql_num_rows($sql_fo);
					
					$fo = $db->config("flushout");
					if($upli && $kmspass>0) {
					if($matchnow > $match) {
						if($ada_fo < $fo) {
						$db->insert("komisi", "", "'', '$upli', '$kmspass', '$clientdate', '0', '', 'kompasangan', '$usere', '".$kode."ps', ''");
						$db->insert("datacwalet", "", "'', '".$kode."ps', 'administrator', '$kmspass', 'Pairing Bonus From $username', '$upli', '$clientdate', 1, '$clientdate', '', ''");
						} else {
						$db->insert("komisi", "", "'', '$upli', '0', '$clientdate', '0', 'flush', 'kompasangan', '$usere', '".$kode."ps', ''");
						}
					} else {
					}
			}	}	
				
							
				$jsp=$db->jumlahsp($sponsore);
					$db->update("upline", "sp='$jsp'", "username='$sponsore'");
				
			
				
		$tgwal = formatgl($clientdate);
$tgend = formatgl($expired);

	

$nama = $db->dataku("nama", $usere);
		$email = $db->dataku("email", $usere);
		$hp = $db->dataku("hp", $usere);
		$alamat = $db->dataku("alamat", $usere);
		$paketnv = $planpaket;
		$pf = $profite;
		$tgl = formatgl($clientdate);
		$waktu = date("H:i:s");
		$jumlahdepone = rupiah($jumlah+$cyclee);
		$ket = $uraian;

$query113 = "SELECT * FROM invoice WHERE kode='$trans_code'"; 
$result113 = mysql_query($query113);
$row113 = mysql_fetch_array($result113);
$file = $row113['file'];
$kode = $row113['kode'];
$tl = $row113['tgl'];
$tgl_inv = date('d-m-Y', strtotime($tl));
$waktu_inv = date('H:i', strtotime($tl));
$tgl_paid = date('d-m-Y', strtotime($clientdate));

$tgldepo = formatgl($clientdate);
  $tglakhir = formatgl($expired);
$pkt_invs = "".$planpaket;

$pkt_invs2 = "".$pakete."";
$prodd = "".$pakete."";

$cyclekontrak = $kontrake." cycle";


if($hp){
$isipesan = "Helo ".$nama.", Your investment package has been active, ".$pakete.", Amount ".rupiah($jumlah).".";
	mysql_query("insert into outbox values('', '', '$usere', '$hp', '$isipesan', '$clientdate', '1')") or die(mysql_error());
	if($smsgtw == 1 && $jsms == 1){
	$hpne = preg_replace('/\D+/', '', $hp);
	$sms = new smsreguler();
	$sms->username = $userkey;
		$sms->password = $passkey;
		$sms->apikey   = $apikey;
		$sms->setTo($hpne);
		$sms->setText($isipesan);
		$sms->smssend();
	}else if($smsgtw == 1 && $jsms == 2){
	$hpne = preg_replace('/\D+/', '', $hp);
	$sms = new smsmasking();
	$sms->username = $userkey;
		$sms->password = $passkey;
		$sms->apikey   = $apikey;
		$sms->setTo($hpne);
		$sms->setText($isipesan);
		$sms->smssend();
	}else if($smsgtw == 2){
	sendsms($hp, $isipesan) ;
	}else{}
}


$isimail_e="<a href='http://".$domain."'><img src='".$logoinvoice."' style='display:inline;outline-style:none;text-decoration:none;' /></a><br><br><br>
<p>Helo ".$nama." (".$usere."),</p>
<p>Your Investment has been active.</p>
<p><strong>No: ".$trans_code."</strong><br>
Package: ".$pakete."<br>
Amount: ".rupiah($jumlah)."<br>
Get Amount: ".rupiah($getamount)."<br>
Cash Back: ".rupiah($cashback)."<br>
Start day : ".$tgwal."<br>
End day : ".$tgend."<br>
</p>

<p><br><br><br>
Regards,<br>
<b>".$bisnisname."</b><br>
".$domain."<br>".$emailadmin."<br>".$hpadmin."</p>";
	   
	    $mail3b = new PHPMailer;
	//	$mail3b->IsSMTP(); // telling the class to use SMTP
        $mail3b->Host       = $smtphost; // SMTP server
        $mail3b->SMTPAuth   = true;                  // enable SMTP authentication
        $mail3b->Host       = $smtphost; // sets the SMTP server
        $mail3b->Port       = $smtport;                    // set the SMTP port for the GMAIL server
        $mail3b->Username   = $smtpuser; // SMTP account username
        $mail3b->Password   = $smtpass;        // SMTP account password
        $mail3b->setFrom($emailadmin, $bisnisname);
        $mail3b->addAddress($email, $nama);
	    $mail3b->IsHTML(true);       
        $mail3b->Subject = ''.$nama.', Your Investment has been active.';
        $mail3b->msgHTML($isimail_e);
	//$mail3b->AddAttachment("../invoice/".$file.".pdf");      // attachment
    $mail3b->send();				
		

  

?>
	 <script type="text/javascript">
        function RefreshParent() {
            if (window.opener != null && !window.opener.closed) {
                window.opener.location.reload();
            }
        }
        window.onbeforeunload = RefreshParent;
    </script>			
	<?php			
			$string = 'Thank You, Invoice ('.$coe.' - '.$jumlahdepone.')\nHas been PAID with your USD Wallet.\n\nYou can review this transaction in transaction page.';
        echo "<script>alert(\"$string\");".
        "window.close()</script>";	
				
				
		
		}
		}
		}
		}
		}
		}
		}
}

}
}
}
?>
<?php 
}else{

?>

<?php
if(isset($_GET["iv"])){ $iv = $_GET["iv"]; }
$coe=base64_decode($iv);

$query35 = "SELECT * FROM dataewalet3 WHERE kode='$coe'"; 
$result35 = mysql_query($query35);
$ceks1 = mysql_num_rows($result35);
$row35 = mysql_fetch_array($result35);
$id = $row35['id'];
$username = $row35['username'];
$jumlah = $row35['jumlah'];
$tgl = $row35['tgl'];
$kode = $row35['kode'];
$status = $row35['status'];
$paket = $row35['paket'];
$plan = $row35['plan'];
$profit = $row35['profit'];
$kontrak = $row35['kontrak'];
$siklus = $row35['siklus'];


$tgle = date('d/m/Y', strtotime($tgl));

		$jumlahdepone = rupiah($jumlah);

$query113 = "SELECT * FROM invoice WHERE kode='$coe'"; 
$result113 = mysql_query($query113);
$row113 = mysql_fetch_array($result113);
$file = $row113['file'];
$prodd="Tagihan ".$kode;
 
 $saldocwallete = $db->mycwalet($username);
			 $pendingcwallete = $db->mycwaletpending($username);
			 $saldoku = $saldocwallete-$pendingcwallete;
			
		
 if($saldoku < $jumlah){
	  
	  echo "<script type=text/javascript>
              alert('Your active wallet balance is insufficient!');
              window.close()
              </script>";		
	  
	exit;		
	} else {	
		
		
if(!$ceks1){
	$string = 'Transaction Not Found!';
        echo "<script>alert(\"$string\");".
        "window.close()</script>";	
	exit;
} else {		
		
if($status == 1){

$string = 'This transaction Already Process!';
        echo "<script>alert(\"$string\");".
        "window.close()</script>";	
	exit;
} else {
?>
<div style="margin-left:150px;">
<?php
$results = $_GET['result'];
if($results == "no_transaction") { 
echo "<div class='alert-box errors'><span>error : </span>Transaction not found!</div>";
}
?>
	<?php
$results = $_GET['result'];
if($results == "already_proccess") { 
echo "<div class='alert-box errors'><span>error : </span>This Transaction already proccessed!</div>";
}
?>
<?php
$results = $_GET['result'];
if($results == "wrong_walet") { 
echo "<div class='alert-box errors'><span>error : </span>Wallet Not found!</div>";
}
?>
<?php
$results = $_GET['result'];
if($results == "wrong_pass") { 
echo "<div class='alert-box warnings'><span>warnings : </span>3 times wrong password your Wallet will be blocked!</div>";
}
?>
<?php
$results = $_GET['result'];
if($results == "wrong_captcha") { 
echo "<div class='alert-box warnings'><span>error : </span>Wrong Security Code!</div>";
}
?>
<?php
$results = $_GET['result'];
if($results == "wrong_id") { 
echo "<div class='alert-box errors'><span>error : </span>User Ewallet Not Found!</div>";
}
?>
<?php
$results = $_GET['result'];
if($results == "wrong_user") { 
echo "<div class='alert-box errors'><span>error : </span>Invalid User eWallet For Members!</div>";
}
?>
<?php
$results = $_GET['result'];
if($results == "blocked") { 
echo "<div class='alert-box errors'><span>error : </span>Ewallet blocked!</div>";
}
?>
<?php
$results = $_GET['result'];
if($results == "insufficient") { 
echo "<div class='alert-box errors'><span>error : </span>Your balance is insufficient</div>";
}
?>
 <?php
$results = $_GET['result'];
if($results == "wrong_auth") { 
echo "<div class='alert-box errors'><span>error : </span>Wrong google authenticator six-digit code!</div>";
}
?>    
 <?php
$results = $_GET['result'];
if($results == "wrong_authx") { 
echo "<div class='alert-box errors'><span>error : </span>Wrong google authenticator six-digit code!</div>";
}
?>    
</div>




















<article class="module width_full" style="width:450px; margin-left:150px;">

			<header>
			  <h3>&nbsp;&nbsp;<img src="../images/bullet_black.png" />&nbsp;&nbsp;Pay Invoice <?php echo $coe; ?> (<?php echo rupiah($jumlah); ?>)</h3>
			</header>
			
				<div class="module_content" style="width:400px;overflow:visible;">
						<form action="page.php?go=waletepay&do=payment&iv=<?php echo $iv; ?>" id="logwalet-form" name="logwalet-form" method="post" class="form-horizontal">
						<fieldset>
							<label>USD Wallet Balance :</label>
							 <input name="" type="text" id="" value="<?php echo rupiah($saldoku);?>" disabled="disabled" style="width:300px;"/>
		
						</fieldset>    
							
<fieldset>
							<label>ID Wallet :</label> 
                            <input name="" type="text" id="" value="<?php echo $db->dataku("accid", $username);?> (<?php echo $username;?>)" disabled="disabled" style="width:300px;"/>
							 <input name="userwalet" type="hidden" id="userwalet" value="<?php echo $username;?>" readonly="readonly"/>
							 <input name="accid" type="hidden" id="accid" value="<?php echo $db->dataku("accid", $username);?>" readonly="readonly"/>
		    <input name="jumlah" type="hidden" id="jumlah" value="<?php echo $jumlah;?>" readonly="readonly"/>
		    <input name="transkode" type="hidden" id="transkode" value="<?php echo $kode;?>" readonly="readonly"/>
		    <input name="prod" type="hidden" id="prod" value="<?php echo $prodd;?>" readonly="readonly"/>
		    <input name="tujuan" type="hidden" id="tujuan" value="<?php echo $username;?>" readonly="readonly"/>
						</fieldset>    
						
                        
                      <fieldset>
							<label>PIN :</label>
			<?php 
					  $results = $_GET['result'];
					  if($results == "wrong_pin") { 
					  echo "<div class='control-group'><div class='controls'><input class='text' name='pincode' maxlength='25' id='pincode' type='password' required='required' style='border-color:#950000; background-color:#FFEAEA;color:#950000;width:200px; ' placeholder='Wrong PIN'></div></div>";
					 } else if($results == "wrong_pin_none") { 
					 echo "<div class='control-group'><div class='controls'><input class='text' name='pincode' maxlength='25' id='pincode' type='password' required='required' style='border-color:#950000; background-color:#FFEAEA;color:#950000;width:200px;' placeholder='Wrong PIN'></div></div>";
					  } else if($results == "wrong_pin_lock") { 
					 echo "<div class='control-group'><div class='controls'><input class='text' name='pincode' maxlength='25' id='pincode' type='password' required='required' style='border-color:#950000; background-color:#FFEAEA;color:#950000;width:200px;' placeholder='PIN Locked'></div></div>";
					  } else if($results == "wrong_pin_invalid") { 
					 echo "<div class='control-group'><div class='controls'><input class='text' name='pincode' maxlength='25' id='pincode' type='password' required='required' style='border-color:#950000; background-color:#FFEAEA;color:#950000;width:200px;' placeholder='Invalid PIN'></div></div>";
					 }else{
					 echo "<div class='control-group'><div class='controls'><input class='text' name='pincode' maxlength='25' id='pincode' type='password' style='width:200px;' required='required'></div></div>";
					 }
					 ?>
                     <div id='logwalet-form_pincode_errorloc' style="font-family:Tahoma,Geneva,Arial,sans-serif;font-size:11px; line-height:150%; color:#D72D2d" ></div>
						</fieldset>  
                        
                        <?php if($db->dataku("authgoogle", $user_session) == 1){ ?>
                       <fieldset>
							<label>2FA Code :</label>
			<?php 
					  $results = $_GET['result'];
					  if($results == "wrong_auth") { 
					  echo "<div class='control-group'><div class='controls'><input class='text' name='one_time_password' maxlength='25' id='one_time_password' type='text' style='border-color:#950000; background-color:#FFEAEA;color:#950000;width:200px; ' placeholder='Wrong 2FA Code' required='required'></div></div>";
					
					 }else{
					 echo "<div class='control-group'><div class='controls'><input class='text' name='one_time_password' maxlength='25' id='one_time_password' type='text' style='width:200px;' required='required'></div></div>";
					 }
					 ?>
						</fieldset>    
                        <?php } ?>
                        
                        
                        
                        
                        
						<div class="clear"></div>
				</div>
			<footer>
			
				<div class="submit_link">
				<button class='primapcm' name='submit' type='submit' >Pay</button>&nbsp;&nbsp;<a href="JavaScript:window.close()"><button class='primapc2m' type='button'><?php echo $LANG["cancel"];?></button></a>
				</div>
				
			</footer>
				
				</form>
			<!--	<script language="javascript">
    storeSomething = function () {
        var test = document.getElementById('pincode');
        test.value = prompt("Enter Your PIN Code", "");
    }
</script>-->
			<script language="JavaScript" src="../js/gen_validatorv4.js" type="text/javascript" xml:space="preserve"></script>
			
			<script language="JavaScript" type="text/javascript"
    xml:space="preserve">//<![CDATA[
//You should create the validator only after the definition of the HTML form
  var frmvalidator  = new Validator("logwalet-form");
  frmvalidator.EnableOnPageErrorDisplay();
frmvalidator.EnableMsgsTogether();

    frmvalidator.addValidation("passewalet","req","&nbsp;&nbsp;&#9679;&nbsp;Enter Password<br><br>");
   frmvalidator.addValidation("php_captcha","req","&nbsp;&nbsp;&#9679;&nbsp;&nbsp;Enter Captcha<br><br>");
   frmvalidator.addValidation("pincode","req","&nbsp;&nbsp;&#9679;&nbsp;&nbsp;Enter PIN<br><br>");
	//  frmvalidator.addValidation("pincode","req","&#9679;&nbsp;&nbsp;Enter PIN!<br><br>");
//]]></script>  		
	
	  </article><!-- end of post new article -->


<?php 
}
}
	}
}
?> 
 </div>
 <?php ob_flush(); ?>