<?php
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();} 
// // #-----------------------------------------------------------------------------#
// // #-------------------------------.*PRIMADESAIN*.-------------------------------#
// // #-------------------------------: Script MMM3 :-------------------------------#
// // #------------------- Copyright 2009-2015 Primadesain.com ---------------------#
// // #----------- Email: primapc57@gmail.com Phone: +62 852 2865 7360 -------------#
// // #--------- http://www.primadesain.com - http://www.primadesain.net -----------#
// // #-----------------------------------------------------------------------------#
// // #------------- Primadesain.Com | Jasa Webdesain Bisnis Online ----------------#
// // #--- Website Bisnis MLM, Bisnis Investasi, Forex, Hyip, Binary, Trinary, -----#
// // #------- Matrix 4 -- 10, Toko Online, Iklan Baris, Profil, Reseller. ---------#
// // #-----------------------------------------------------------------------------#
// // # This software is  furnished  under a  license and may  be used and   copied #
// // # only  in accordance with the terms of such  license and with  the inclusion #
// // # of  the above copyright notice.  This software or any other  copies thereof #
// // # may not be  provided or otherwise made available  to any other person.   No #
// // # title to and  ownership of the software is hereby transferred.              #
// // #                                                                             #
// // # You  may  not  reverse   engineer,  decompile,  defeat  license  encryption #
// // # mechanisms, or  disassemble  this  software  product  or software   product #
// // # license. We  may terminate  this license if you  don't comply  with any  of #
// // # the terms and   conditions set forth   in our  End  User  License Agreement #
// // # (EULA). In  such event, licensee  agrees to return licensor or  destroy all #
// // # copies of software upon termination  of the license.                        #
// // # Please see the EULA file for the full End User License Agreement.           #
// // ###############################################################################
?>
<?php
if($db->dataku("status", $user_session) == 0 || $db->dataku("blokir", $user_session) == 1) {
echo "<div class='alert alert-danger'><button type='button' class='close' data-dismiss='alert'><i class='icon-remove'></i></button><h4> Error!</h4><p>".$LANG["status0"]."</p></div>";
}else{
?>



<?
if(isset($_POST['sendnow'])){
	




$username = anti_injection($_POST['user']);	
$kode = anti_injection($_POST['kode']);	
$produk = anti_injection($_POST['produk']);
$amount = $_POST['amount'];
if($produk == 1){
$biaya = $biaya1;
$biayax = $biayax1;
$myproduk = $jenis1;
$profite = $invest_profits1;
$priode = $inv_kontrak1;
$siklus = $invest_priod1;
}else if($produk == 2){
$biaya = $biaya2;
$biayax = $biayax2;
$myproduk = $jenis2;
$profite = $invest_profits2;
$priode = $inv_kontrak2;
$siklus = $invest_priod2;
}else if($produk == 3){
$biaya = $biaya3;
$biayax = $biayax3;
$myproduk = $jenis3;
$profite = $invest_profits3;
$priode = $inv_kontrak3;
$siklus = $invest_priod3;
}else if($produk == 4){
$biaya = $biaya4;
$biayax = $biayax4;
$myproduk = $jenis4;
$profite = $invest_profits4;
$priode = $inv_kontrak4;
$siklus = $invest_priod4;
}else if($produk == 5){
$biaya = $biaya5;
$biayax = $biayax5;
$myproduk = $jenis5;
$profite = $invest_profits5;
$priode = $inv_kontrak5;
$siklus = $invest_priod5;
}else if($produk == 6){
$biaya = $biaya6;
$biayax = $biayax6;
$myproduk = $jenis6;
$profite = $invest_profits6;
$priode = $inv_kontrak6;
$siklus = $invest_priod6;
}else if($produk == 7){
$biaya = $biaya7;
$biayax = $biayax7;
$myproduk = $jenis7;
$profite = $invest_profits7;
$priode = $inv_kontrak7;
$siklus = $invest_priod7;
}else if($produk == 8){
$biaya = $biaya8;
$biayax = $biayax8;
$myproduk = $jenis8;
$profite = $invest_profits8;
$priode = $inv_kontrak8;
$siklus = $invest_priod8;
}else if($produk == 9){
$biaya = $biaya9;
$biayax = $biayax9;
$myproduk = $jenis9;
$profite = $invest_profits9;
$priode = $inv_kontrak9;
$siklus = $invest_priod9;
}else if($produk == 10){
$biaya = $biaya10;
$biayax = $biayax10;
$myproduk = $jenis10;
$profite = $invest_profits10;
$priode = $inv_kontrak10;
$siklus = $invest_priod10;
}else{
}

$amount = $biaya;

$pincods = md5($_POST['pincode']);	
$sqlc = mysql_query("SELECT pass FROM member WHERE username='$user_session'");
$numc = mysql_num_rows($sqlc);
while($rowc = mysql_fetch_array($sqlc)){
$tgl = formatgl($rowc['tgl']);
$pass = $rowc['pass'];
	}
	if(!$numc) {
	header("location: index.php?go=addeposit&result=no_pass");
	exit;
} else {
if(!$pincods || $pincods <> $pass) {
	header("location: index.php?go=addeposit&result=wrong_pass");
	exit;
} else {



$sql_sp9d2 = mysql_query("select * from dataewalet3 where kode='$kode' and username='".$username."'");
$ada_sp9d2 = mysql_num_rows($sql_sp9d2);
if($ada_sp9d2){
header("location: index.php?go=addeposit&result=errors");
	exit;
} else {	

$expired = date('Y-m-d H:i:s', strtotime("+".$batastransfere." hour"));			
$db->insert("dataewalet3", "", "'', '$kode', '$username', '$amount', '', '$clientdate', '$expired', '0', '$produk', '$myproduk', '$profite', '', '$priode', '$siklus'");

	$db->insert("notifikasi", "", "'', '$username', 'Registrasi', '', '', 'Make an investment payment you choose, package ".$myproduk.", amount ".rupiah($amount)."', '$clientdate', 'label label-sm label-icon label-info', 'fa fa-info', '0', '$kode'");





$jumlahdepone = rupiah($amount);
$prodd="Add Deposite ".$myproduk."";
$nama = $db->dataku("nama", $username);
$hp = $db->dataku("hp", $username);
$email = $db->dataku("email", $username);
	
$tkk = date('dmYHis', strtotime($clientdate));
$tokens = substr(str_shuffle(str_repeat("4453B141119A06676420371112GEHDLPD8717497783C6255363423ABCYWTGEHDLPMBTEFWXVU96411241472162223777", 64)), 0, 48);

$invc = "REG_".strtoupper($username)."_".$tkk."_".$stmpkodene."_".$tokens;
$inv = "http://".$domain."/invoice/".$invc.".pdf";
//$db->insert("invoice", "", "'', '$username', '$kode', '$invc', '$clientdate'");   

 $bank = $db->config("bank");if($bank){ $banke = $bank."<br>"; }
 $bank1 = $db->config("bank1");if($bank1){ $banke1 = $bank1."<br>"; }
 $bank2 = $db->config("bank2");if($bank2){ $banke2 = $bank2."<br>"; }
 $bank3 = $db->config("bank3");if($bank3){ $banke3 = $bank3."<br>"; }
 $bank4 = $db->config("bank4");if($bank4){ $banke4 = $bank4."<br>"; }
 $bank5 = $db->config("bank5");if($bank5){ $banke5 = $bank5."<br>"; }
 $bank6 = $db->config("bank6");if($bank6){ $banke6 = $bank6.""; }
 
 if($bank){ $bankex = $bank.", "; }
 if($bank1){ $bankex1 = $bank1.", "; }
 if($bank2){ $bankex2 = $bank2.", "; }
 if($bank3){ $bankex3 = $bank3.", "; }
 if($bank4){ $bankex4 = $bank4.", "; }
 if($bank5){ $bankex5 = $bank5.", "; }
 if($bank6){ $bankex6 = $bank6.""; }
 
 $bankadmins=$banke."".$banke1."".$banke2."".$banke3."".$banke4."".$banke5."".$banke6;
 $bankadminsx=$bankex."".$bankex1."".$bankex2."".$bankex3."".$bankex4."".$bankex5."".$bankex6;



$isimail="<a href='http://".$domain."'><img src='".$logoinvoice."' style='display:inline;outline-style:none;text-decoration:none;' /></a><br><br><br>
<p>Hello ".$nama." (".$username."),</p>
<p>Your Add Investment.</p>
<p><strong>No: ".$kode."<br>
Package: ".$myproduk."<br>
Amount: ".$jumlahdepone."<br>
</p>
<p>Please login area and make payments according to the value of your investment before expired ".formatgl($expired).".</p>
<p>Payment To ".$bankadmins.".</p>

<p><br><br><br>
Best Regards,<br>
<b>".$bisnisname."</b><br>
".$domain."<br>".$emailadmin."<br>".$hpadmin."</p>";
	   
	    $mail3 = new PHPMailer;
        $mail3->setFrom($emailadmin, $bisnisname);
        $mail3->addAddress($email, $nama);
	    $mail3->IsHTML(true);       
        $mail3->Subject = ''.$nama.', Make Deposit';
        $mail3->msgHTML($isimail);
	  //  $mail3->AddAttachment("../invoice/".$invc.".pdf");      // attachment
        $mail3->send();	




$isipesan = "Hello ".$nama.", your make deposite, Package ".$myproduk.", No: ".$kode.", Amount: ".$jumlahdepone.". Please make payment before ".formatgl($expired).".";
	mysql_query("insert into outbox values('', '', '$username', '$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{}






	header("location: index.php?go=addeposit&result=success&co=$kode");
	exit;
}
}
}



?>



<?php
}else{


?>


<?php
 if(isset($_GET['result'])&&$_GET['result']=="success"){
if(isset($_GET["co"])){ $co = $_GET["co"]; }
echo "<div class='alert alert-success alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'></button>Add Investment ".$co." successfully created, please make payment according to the value of your investment.</div>";
}
?>

<?php
 if(isset($_GET['result'])&&$_GET['result']=="no_pin"){
echo "<div class='alert alert-danger alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'></button>".LANG_FORGOT_NO_PIN."</div>";
}
?>  
 <?php
 if(isset($_GET['result'])&&$_GET['result']=="wrong_pin"){
echo "<div class='alert alert-danger alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'></button>".LANG_FORGOT_WRONG_PIN."</div>";
}
?>  
 <?php
 if(isset($_GET['result'])&&$_GET['result']=="pin_lock"){
echo "<div class='alert alert-danger alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'></button>".LANG_FORGOT_BLOCK_PIN."</div>";
}
?>  

 <?php
 if(isset($_GET['result'])&&$_GET['result']=="pin_off"){
echo "<div class='alert alert-danger alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'></button>".LANG_FORGOT_OFF_PIN."</div>";
}
?>
<?php
 if(isset($_GET['result'])&&$_GET['result']=="amount"){
echo "<div class='alert alert-danger alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'></button>Amount investment must be filled!</div>";
}
?>
<?php
 if(isset($_GET['result'])&&$_GET['result']=="errors"){
echo "<div class='alert alert-danger alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'></button>This transaction already submit before!</div>";
}
?>
<?php
 if(isset($_GET['result'])&&$_GET['result']=="no_pass"){
echo "<div class='alert alert-danger alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'></button>Your membership is not valid, please contact administrator.</div>";
}
?>  
 <?php
 if(isset($_GET['result'])&&$_GET['result']=="wrong_pass"){
echo "<div class='alert alert-danger alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'></button>Wrong password</div>";
}
?>
<?php
if(isset($_GET['result'])&&$_GET['result']=="min"){
$pck = base64_decode($_GET['pk']);
$min = base64_decode($_GET['mn']);	
	
echo "<div class='alert alert-danger alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'></button>You choose package ".$pck.", Minimal investment for this package is ".rupiah($min).".</div>";
}
?>
<?php
if(isset($_GET['result'])&&$_GET['result']=="max"){
$pck = base64_decode($_GET['pk']);
$max = base64_decode($_GET['mx']);
	
echo "<div class='alert alert-danger alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'></button>You choose package ".$pck.", Max investment for this package is ".rupiah($max).".</div>";
}
?>




  <?php
$results = $_GET['result'];
if($results == "error") { 
echo "<div class='alert alert-danger alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'></button>".$LANG["tctnotfnd"]."</div>";
}
?>



<?php      
$initiale = substr(str_shuffle(str_repeat("ABCEFGHIJKLMNPRSTUVWXYZ", 36)), 6, 2);
$stkode = strtotime(date("Y-m-d H:i:s"));
$kodec = $initiale."".$stkode;
$initialex = substr(str_shuffle(str_repeat("ABEF123456789GHIJKLMNPR123456789KLEFGHILMNP123456789RRSTUVWXYZ", 46)), 22, 12);


$sql_sp9d = mysql_query("select * from deposit where status='1' and username='".$user_session."'");
$ada_sp9d = mysql_num_rows($sql_sp9d);
if($maksinvest>0 && $ada_sp9d >= $maksinvest){
	$stss="<p><div class='alert alert-danger alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'></button>You have ".$ada_sp9d." investment packages were still active, maximum of only ".$maksinvest." active investment package.</div></p>";
	$diss=" disabled='disabled'";
}else{
	
$sql_sp9d2 = mysql_query("select * from dataewalet3 where status='0' and username='".$user_session."'");
$ada_sp9d2 = mysql_num_rows($sql_sp9d2);
if($maksinvest>0 && $ada_sp9d2 >= $maksinvest){
	$stss="<p><div class='alert alert-danger alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'></button>You have ".$ada_sp9d." investment packages were still active, maximum of only ".$maksinvest." active investment package.</div></p>";
	$diss=" disabled='disabled'";	
	
}else{
	
	
$stss="";
$diss="";
}
}
?>

<?php echo $stss; ?>     
        
        	       
<script type="text/javascript">
 
        function isNumberKey(evt, obj) {
 
            var charCode = (evt.which) ? evt.which : event.keyCode
            var value = obj.value;
            var dotcontains = value.indexOf(".") != -1;
            if (dotcontains)
                if (charCode == 46) return false;
            if (charCode == 46) return true;
            if (charCode > 31 && (charCode < 48 || charCode > 57))
                return false;
            return true;
        }
 

 
    </script>               
<div class="row">
                        
                        	<div class="col-md-12">
                            	<div class="panel panel-primary ">
                        <!-- Start .panel -->
                        <div class="panel-heading">
                           <h3 class="panel-title"><strong>Make Deposit</strong></h3>
                        </div>
                        <div class="panel-body">
										     
                                             <form role="form" method="POST" class="form-horizontal">  
											
<input type="hidden" id="kode" name="kode" value="<?php echo $initialex; ?>"/>
<input type="hidden" id="user" name="user" value="<?php echo $user_session; ?>"/>
			                              
                                            
											<div class="form-body">
                                            
                                            
                                            
                 
   <div class="form-group">
													<label class="col-md-3 control-label">Package</label>
													<div class="col-md-4">
														<div class="input-group">
														 <select name="produk" id="produk" class="form-control" required='required' <?php echo $diss; ?> >
                         
          <?php
	
	for($i=0;$i<$batas_paket;$i++) {	
	 $ic = $i;
	 $icc = $i+1;
	 $produke = $lead[$ic];
	 $byaya = rupiah($by[$ic]);
	 
	  if($_SESSION["produke"] == $icc){
		  $stttt = " selected='selected'";
	  }else{
		  
		  if($_GET["p"] == $icc){
		  $stttt = " selected='selected'";
		  }else{
		  $stttt = "";
	  }
	  }
	 
	 echo"<option value='".$icc."' $stttt>$produke - $byaya</option>";
	 }
	 ?> 	  
			 
          </select>
														</div>
													</div>
												</div>
  
			 
                                           
                                              
   <div class="form-group">
													<label class="col-md-3 control-label">Enter Your Password</label>
													<div class="col-md-4">
														<div class="input-group">
															
															<input type="password" class="form-control" placeholder="Enter Your Password" name="pincode" required='required'>
                                                          
                                                          

														</div>
													</div>
												</div>
                                              
                                                
                                                
                                              <div class="form-actions">
												<div class="row">
													<div class="col-md-offset-3 col-md-9">
														<button type="submit" class="btn btn-primary" name="sendnow"  <?php echo $diss; ?> <?php echo $dissc; ?>><i class="fa fa-check"></i>&nbsp;Submit</button>
													</div>
												</div>
											</div>
                     
										</form>
										<!-- END FORM-->
									 </div>
                            
                            </div>
                        
                        
                        </div>
								</div>
								</div>



            
            
    <?php
	unset($_SESSION['amounte']);
unset($_SESSION['durasie']);
unset($_SESSION['typese']);	
	?>        
            
  <!-- Your Page Content Here -->
<?php } } ?></div>