<?php
(@include ('../dt_page/lic.php')) or die("<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>");
//$lic=$license;if(!$lic){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>";}$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 "<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();}
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();} 
?>
 <div class="row">
            <div class="col-md-12">
                <h1 class="page-header">
                    <img src="../themes/img/bonus.png" alt="Deposit" class="header-icon" width="30">
                    Re-Investment
                </h1>
            </div>
        </div>

<?php
if($db->dataku("status", $user_session) == 0 || $db->dataku("blokir", $user_session) == 1) {
echo "<div class='alert alert-danger alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'></button>".$LANG["status0"]."</div>";
}else{
?>

  
                                                
<div class="row">
            	
                
                
                
                             <div class="col-md-3">
                
                
				  <div class="panel panel-inverse">
                        <div class="panel-heading bg-grey">
                            <h4 class="text-white">Re-Investment</h4>
                        </div>
                        <div class="panel-body">
               
               
               
               <?
if(isset($_POST['sendnow'])){
	
	
$authgoogles=$db->dataku("authgoogle", $user_session);
$code    = anti_injection($_POST['one_time_password']);	  
$result  = $authenticator->verifyCode($secret,$code,$tolerance);
if($googleauntentic == 1 && $authgoogles == 1 && !$result){
header("location: index.php?go=reinvest&result=wrong_auth");
exit;
} else {	  	
	
	
	

$username = anti_injection($_POST['user']);	
$kode = anti_injection($_POST['kode']);	
$kodedp = anti_injection($_POST['kodedp']);	
$produk = anti_injection($_POST['produk']);


$queryvvv = "SELECT * FROM deposit WHERE username='$username' and status='0' and gt='1' and kode='$kodedp'"; 
$resultvvv = mysql_query($queryvvv);
$ada_dpone = mysql_num_rows($resultvvv);
if(!$ada_dpone){
  header("location: index.php?go=reinvest&result=nodepo");
	exit;
} else {


$saldonedepo=total_deposit_membere($user_session, $kodedp, 1);
		 $wdtopayne=total_deposit_towd($user_session, $kodedp);
		 $wdtoreinve=total_deposit_toreinvest($user_session, $kodedp);
		 $amount=$saldonedepo-$wdtopayne-$wdtoreinve;


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{
}

if($amount < $biaya){
header("location: index.php?go=reinvest&result=min&pk=".base64_encode($myproduk)."&mn=".base64_encode($biaya)."");
exit;
} else {


if($amount > $biayax){
header("location: index.php?go=reinvest&result=max&pk=".base64_encode($myproduk)."&mx=".base64_encode($biayax)."");
exit;
} else {

$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: index.php?go=reinvest&result=no_pin");
	exit;
} else {
if(!$pincods || $pincods <> $pin) {
	header("location: index.php?go=reinvest&result=wrong_pin");
	exit;
} else {
if($lock == 1) {
	header("location: index.php?go=reinvest&result=pin_lock");
exit;
	} else {
if($sts == 0) {
	header("location: index.php?go=reinvest&result=pin_off");
	exit;
} else {	
	
	
	
$sql_sp9d2w = mysql_query("select * from dataewalet3 where username='".$username."' and status=0");
$ada_sp9d2w = mysql_num_rows($sql_sp9d2w);
if($ada_sp9d2w){
header("location: index.php?go=reinvest&result=errors1");
	exit;
} else {		
	
	
	
	$sql_sp9d2e = mysql_query("select * from deposit where username='".$username."' and status=1");
$ada_sp9d2e = mysql_num_rows($sql_sp9d2e);
if($ada_sp9d2e == $maksinvest){
header("location: index.php?go=reinvest&result=errors2");
	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=reinvest&result=errors");
	exit;
} else {	

$expired = date('Y-m-d H:i:s', strtotime("+".$batastransfere." hour"));			
$db->insert("dataewalet3", "", "'', '$kode', '$username', '$amount', '$kodedp', '$clientdate', '$expired', '1', '$produk', '$myproduk', '$profite', '', '$priode', '$siklus'");
$db->insert("notifikasi", "", "'', '$username', 'Re-Invest', '', '', 'Re-invest 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);
	


$ttlkontrak = $priode;

$expired = date('Y-m-d H:i:s', strtotime("+".$ttlkontrak." ".$siklus.""));
$pakete="Package ".$myproduk."";
$harine2 = date("N");
$tgwal = formatgl($clientdate);
$tgend = formatgl($expired);

$cekadaneg = mysql_query("select kode from deposit where kode='$kode'");
$ada_adaneg = mysql_num_rows($cekadaneg); 
if(!$ada_adaneg) {
$db->insert("deposit", "", "'', '$username', '$kode', '$amount', '1', '$clientdate', '$expired', '$produk', '$myproduk', '$profite', '$priode', '', '$siklus', '0', '$kodedp'"); 
}
$db->update("deposit", "gt='3', kodp='$kode'", "kode='$kodedp'");	
$db->update("reinv", "status='1'", "username='$username'");	
$db->update("member", "harga='$produk', stage='$myproduk', sto='1', act='1'", "username='$username'");

$cekadane = mysql_query("select kode from wdxx where kode='$kodedp' and userid='$username'");
$ada_adane = mysql_num_rows($cekadane); 
if(!$ada_adane) {
$db->insert("wdxx", "", "'', '$username', '$clientdate', '', '$amount', '', '', '0', '', '$kodedp', '1'"); 		
}

$sponsore = $db->dataku("sponsor", $username);
			$sponsorelev2 = $db->dataku("sponsor", $sponsore);
			$sponsorelev3 = $db->dataku("sponsor", $sponsorelev2);
			$sponsorelev4 = $db->dataku("sponsor", $sponsorelev3);
			$sponsorelev5 = $db->dataku("sponsor", $sponsorelev4);
			$sponsorelev6 = $db->dataku("sponsor", $sponsorelev5);
			$sponsorelev7 = $db->dataku("sponsor", $sponsorelev6);
			$sponsorelev8 = $db->dataku("sponsor", $sponsorelev7);
			$sponsorelev9 = $db->dataku("sponsor", $sponsorelev8);
			$sponsorelev10 = $db->dataku("sponsor", $sponsorelev9);		
							
				$kmspons = explode("|", $db->config("komisi_sponsor"));	
			$komsponx = ($kmspons[0]/100)*$amount;
			$komsponx2 = ($kmspons[1]/100)*$amount;
			$komsponx3 = ($kmspons[2]/100)*$amount;
			$komsponx4 = ($kmspons[3]/100)*$amount;
			$komsponx5 = ($kmspons[4]/100)*$amount;
			$komsponx6 = ($kmspons[5]/100)*$amount;
			$komsponx7 = ($kmspons[6]/100)*$amount;
			$komsponx8 = ($kmspons[7]/100)*$amount;
			$komsponx9 = ($kmspons[8]/100)*$amount;
			$komsponx10 = ($kmspons[9]/100)*$amount;			
							
							
							
				if($sponsore && $komsponx > 0) {  
					$db->insert("komisi", "", "'', '$sponsore', '$komsponx', '$clientdate', '0', '', 'komsponsor', '$username', '".$kode."sp', ''");
				}
			   
			    if($sponsorelev2 && $komsponx2 > 0) {
					$db->insert("komisi", "", "'', '$sponsorelev2', '$komsponx2', '$clientdate', '0', '', 'komsponsor2', '$username', '".$kode."sp2', ''");
				}
				if($sponsorelev3 && $komsponx3 > 0) {
					$db->insert("komisi", "", "'', '$sponsorelev3', '$komsponx3', '$clientdate', '0', '', 'komsponsor3', '$username', '".$kode."sp3', ''");
				}
				if($sponsorelev4 && $komsponx4 > 0) {
					$db->insert("komisi", "", "'', '$sponsorelev4', '$komsponx4', '$clientdate', '0', '', 'komsponsor4', '$username', '".$kode."sp4', ''");
				}	
				if($sponsorelev5 && $komsponx5 > 0) {
					$db->insert("komisi", "", "'', '$sponsorelev5', '$komsponx5', '$clientdate', '0', '', 'komsponsor5', '$username', '".$kode."sp5', ''");
				}
				if($sponsorelev6 && $komsponx6 > 0) {
					$db->insert("komisi", "", "'', '$sponsorelev6', '$komsponx6', '$clientdate', '0', '', 'komsponsor6', '$username', '".$kode."sp6', ''");
				}
				if($sponsorelev7 && $komsponx7 > 0) {
					$db->insert("komisi", "", "'', '$sponsorelev7', '$komsponx7', '$clientdate', '0', '', 'komsponsor7', '$username', '".$kode."sp7', ''");
				}
				if($sponsorelev8 && $komsponx8 > 0) {
					$db->insert("komisi", "", "'', '$sponsorelev8', '$komsponx8', '$clientdate', '0', '', 'komsponsor8', '$username', '".$kode."sp8', ''");
				}
				if($sponsorelev9 && $komsponx9 > 0) {
					$db->insert("komisi", "", "'', '$sponsorelev9', '$komsponx9', '$clientdate', '0', '', 'komsponsor9', '$username', '".$kode."sp9', ''");
				}
				if($sponsorelev10 && $komsponx10 > 0) {
					$db->insert("komisi", "", "'', '$sponsorelev10', '$komsponx10', '$clientdate', '0', '', 'komsponsor10', '$username', '".$kode."sp10', ''");
				}			
							




$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 Re-Investment.</p>
<p><strong>No: ".$kode."<br>
Package: ".$myproduk."<br>
Amount: ".$jumlahdepone."<br>
Date: ".$tgl."<br>
</p>

<p><br><br><br>
Salam,<br>
<b>".$bisnisname."</b><br>
".$domain."<br>".$emailadmin."<br>".$hpadmin."</p>";
	   
	    $mail3 = new PHPMailer;
		if($smaile == 1){	
$mail3->IsSMTP(); // telling the class to use SMTP
$mail3->Host       = $smtphost; // SMTP server
$mail3->SMTPAuth   = true;                  // enable SMTP authentication
$mail3->Host       = $smtphost; // sets the SMTP server
$mail3->Port       = $smtport;                    // set the SMTP port for the GMAIL server
$mail3->Username   = $smtpuser; // SMTP account username
$mail3->Password   = $smtpass;        // SMTP account password
}
        $mail3->setFrom($emailadmin, $bisnisname);
        $mail3->addAddress($email, $nama);
	    $mail3->IsHTML(true);       
        $mail3->Subject = ''.$nama.', Your Re-Investment';
        $mail3->msgHTML($isimail);
	  //  $mail3->AddAttachment("../invoice/".$invc.".pdf");      // attachment
        $mail3->send();	



if($hp){
$isipesan = "Hello ".$nama.", your Re-Investment, Package ".$myproduk.", No: ".$kode.", Amount: ".$jumlahdepone.".";
	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=reinvest&result=success&co=$kode");
	exit;
}
}
}
}
}
}
}
}
}
}
}
?>



<?php
}else{


?>
 <?php
$results = $_GET['result'];
if($results == "nodepo") { 
echo "<div class='alert alert-danger'>Deposit tidak ditemukan!</div>";
}
?>   

<?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
 if(isset($_GET['result'])&&$_GET['result']=="errors1"){
echo "<div class='alert alert-danger alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'></button>You have added deposit and not yet processed! Wait for add deposits previously processed to be able to add deposit again.</div>";
}
?>
<?php
 if(isset($_GET['result'])&&$_GET['result']=="errors2"){
echo "<div class='alert alert-danger alert-dismissable'><button type='button' class='close' data-dismiss='alert' aria-hidden='true'></button>max deposit active is ".$maksinvest." deposit.</div>";
}
?>
		<?php
if(isset($_GET['result'])&&$_GET['result']=="wrong_captcha"){
echo "<div class='alert alert-danger'>Wrong Captcha!</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
$results = $_GET['result'];
if($results == "wrong_auth") { 
echo "<div class='alert alert-danger'>You're enable two factor authentication at your account, Please enter your google authenticator six-digit code!</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);




?>

               
               
               
               
               
               
               
               
               
               
               
               
<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>         
               
               
                <form id="tab2" name="add_depo" method="post" action="">

<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="controls-row">

            <label>Package</label>

            <select name="produk" id="produk" class="form-control" required='required'>
                         
          <?php
	
	for($i=0;$i<$batas_paket;$i++) {	
	 $ic = $i;
	 $icc = $i+1;
	 $produke = $lead[$ic];
	 $byaya = rupiah($by[$ic]);
	 $byaya2 = rupiah($byx[$ic]);
	 
	  if($_SESSION["produke"] == $icc){
		  $stttt = " selected='selected'";
	  }else{
		  
		  if($_GET["p"] == $icc){
		  $stttt = " selected='selected'";
		  }else{
		  $stttt = "";
	  }
	  }
	 
	 echo"<option value='".$icc."' $stttt>$produke [Min. $byaya, Max. $byaya2]</option>";
	 }
	 ?> 	  
			 
          </select>

          </div>
          
          
          
     <div class="controls-row" style="margin-top:10px;">

            <label>Deposit Re-Invest</label>
            
            
            <select name="kodedp" id="kodedp" class="form-control" required='required'>
            
         <?php 
		 $queryvvv = "SELECT * FROM deposit WHERE username='$user_session' and status='0' and gt='1'"; 
         $resultvvv = mysql_query($queryvvv) or die(mysql_error());
		 $ada_dpone = mysql_num_rows($resultvvv);
		 if($ada_dpone){
         while($rowvvv = mysql_fetch_array($resultvvv)){
         $kode = $rowvvv['kode'];
         $jml = $rowvvv['jml'];
         $planame = $rowvvv['planame'];
		 
		 $saldonedepo=total_deposit_membere($user_session, $kode, 1);
		 $wdtopayne=total_deposit_towd($user_session, $kode);
		 $wdtoreinve=total_deposit_toreinvest($user_session, $kode);
		 $sisasaldone=$saldonedepo-$wdtopayne-$wdtoreinve;
		 if($sisasaldone > 0){
		 echo"<option value='".$kode."'>$planame - ".rupiah($sisasaldone)." (".$kode.")</option>";
		 } else {
		 echo"<option value=''>-- No Balance --</option>"; 
		 }
			} 
		 }else{
		 echo"<option value=''>-- No Balance --</option>";
		 }
         ?>
         </select>
          </div>  
          
          
          
          <div class="controls-row" style="margin-top:10px;">

            <label>PIN</label>

           <input type="password" class="form-control" placeholder="Enter Your PIN" name="pincode" required='required'>
                                                          

          </div>

          <?php if($db->dataku("authgoogle", $user_session) == 1){ ?>
            <div class="controls-row" style="margin-top:10px;">

            <label>2FA Code</label>

           <input type="text" class="form-control" placeholder="Enter Google 2FA Code" name="one_time_password">
                                                          

          </div>
<?php } ?>

         
 <div>

           &nbsp;

          </div>
          <div>
        
            <button type="submit" class="btn btn-primary" name="sendnow"><i class="fa fa-check"></i>&nbsp;Submit</button>

          </div>

        </form>
        
        <?php } ?>
        
                </div></div> </div>   
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                
                <div class="col-md-9">
                	
                    
                    <div class="panel panel-inverse">
                        <div class="panel-heading bg-grey">
                            <h4 class="text-white">Re-Investment</h4>
                        </div>
                        
                        <div class="panel-body">
                        
                        
                        
                        
                          <div class="table-responsive">
                        
                                                          
                                    <table id="data-table" class="table table-bordered" cellspacing="0" width="100%">
                    
                    
              <thead>
                <tr>
                 <th>No</th> 
                        <th>Package</th> 
                        <th>Date</th> 
                        <th>Exp</th> 
                        <th>Remaining</th> 
                        <th>Amount</th> 
                        <th>Status</th>
                        <th>#</th>
                </tr>
              </thead>
              <tbody>
      <?

	$db->select("id, username, kode, jml, status, tgldepo, tglend, planame, profit, kontrak, gt, kodp", "deposit", "username='$user_session' and gt=3", "id desc");
	
		while($row=$db->fetch_row()) {
			
			
			if(is_odd($nom) == 0) {
				$class = "even";
			} else {
				$class = "odd";
			} 	
			
			$stats = $row[8];	
  
	$cccc=base64_encode($row[1]);
	
	
	
		if($row[4] > 0) {
				$st = "<span class='btn btn-success btn-xs'>".$LANG["mbdepo_active"]."</span>";
			} else {
				$st = "<span class='btn btn-danger btn-xs'>".$LANG["mbdepo_nactive"]."</span>";
			}		
			
			$pkt_invs2 = "Package ".$row[7]."";
			$dinone = $row[5];
			$akhire = $row[6]; 
$days = ceil((strtotime("$akhire") - time())/(60*60*24));

$dinone = $days;
$dinone2 = $dinone." days";
if ($dinone <= 0) {
     $statuse = "<span class='btn btn-danger btn-xs'>".$LANG["mbdepo_stop"]."</span>";
     $tox = $row[6];
	 $dinone2 = "--";
				$style = "<font color='#F00000'>";

} else {
     $statuse = "<span class='btn btn-success btn-xs'>".$LANG["mbdepo_active"]."</span>";
     $tox = $row[6];
	  $dinone2 = $dinone2;
				$style = "<font>";
}
$total_depositex = total_deposit_member($user_session);
if($total_depositex > 0){
$total_deposite = rupiah($total_depositex);
}else{
$total_deposite = "0";
}

if($row[5] == "0000-00-00 00:00:00"){
$dtdepo = "----";
}else{
$dtdepo = formatgl($row[5]);
}

if($tox == "0000-00-00 00:00:00" || !$tox){
$dtexp = "----";
}else{
$dtexp = formatgl($tox);
}
	
	
	
		
?>				
                             
                    <tr> 
                            
                            <td><?php echo $row[2]; ?></td>
                            <td><?php echo $pkt_invs2; ?></td>
                            <td><?php echo $dtdepo; ?></td>
                            <td><?php echo $dtexp; ?></td>
                            <td><?php echo $dinone2; ?></td>
                            <td><?php echo rupiah($row[3]); ?></td>
                            <td><?php echo $st; ?></td>
                          <td>
						  <?php if($row[4] == 0 && $row[10] == 1) { ?>
                          <a href="index.php?go=reinvest"><button type="button" class="btn btn-success btn-xs">Re-Invest</button></a>
                          <a href="index.php?go=withdrawaldepo"><button type="button" class="btn btn-warning btn-xs">Withdrawal</button></a>
                          <?php } else if($row[4] == 0 && $row[10] == 2) { ?>
                          Withdrawal <?php echo $row[11];?>
                          <?php } else if($row[4] == 0 && $row[10] == 3) { ?>
                          Reinvest <?php echo $row[11];?>
                          <?php }else { echo "---";} ?>
                          </td>

                        </tr>
                        <?php } ?>
              </tbody>
            </table>
                        </div>
                    </div>
                </div>
			</div>
			</div>
			<!-- END PAGE CONTENT -->                       















                     
<?php } ?>

			</div>