<?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();} 
?>
<?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{
?>

<link rel="stylesheet" type="text/css" href="../assets/global/plugins/bootstrap-datepicker/css/bootstrap-datepicker3.min.css"/>
<script type="text/javascript" src="../assets/global/plugins/bootstrap-datepicker/js/bootstrap-datepicker.min.js"></script>
<link href="../assets/admin/pages/css/todo.css" rel="stylesheet" type="text/css"/>
<link href="../assets/treeview/treeviewx.css" rel="stylesheet">
        <script src="../assets/treeview/treeview.js"></script>


<?php
if (isset($_GET['dt']) && $_GET['dt'] == "1") {

if(isset($_GET["co"])){ $co = anti_injection(base64_decode($_GET["co"])); }                  
                              
$query2 = "SELECT * FROM konfirmasi WHERE kode='".mysql_real_escape_string($co)."'"; 
$result2 = mysql_query($query2);
$numc2 = mysql_num_rows($result2);
$rowc2 = mysql_fetch_array($result2);
$stsconfirm=$rowc2['status'];
$memo=$rowc2['catatan'];
$image=$rowc2['foto'];
$usernya=$rowc2['username'];
$dateconfrm=$rowc2['tgl'];
$tglconfrm=$rowc2['tglconfirm'];
$kode=$rowc2['kode'];
$jumlah=$rowc2['jumlah'];
$rektujuan=$rowc2['rektujuan'];

$adafotow = $db->dataku("foto", $usernya);
	$dirfotow = "./images/$adafotow";
	if (!empty($adafotow) && (file_exists($dirfotow))){
		$gambarw = "<a href='".$dirfotow."' class='highslide pull-left' onclick='return hs.expand(this)'><img src='".$dirfotow."' width='27' height='27' class='todo-userpic'></a>";
		}
	else
		{
		$gambarw = "<a class='pull-left' href='javascript:;'><img src='../images/no_image.png' width='27' height='27' class='todo-userpic'></a>";
		} 



if($stsconfirm == 0){
	$sts = "<span class='label label-warning'>Pending</span>";
}else{
	$sts = "<span class='label label-success'>Confirmed</span>";
}

$dirimage = "../images/confirm/".$image."";
	if (!empty($image) && (file_exists($dirimage))){
		$gambarx = "<img src='".$dirimage."'></a>";
		}
	else
		{
		$gambarx = "<img src='../images/no-photo.png'>";
		} 
		
if($tglconfrm == "0000-00-00 00:00:00"){
$tglconfrme = "----";
}else{
$tglconfrme = formatgl($tglconfrm);
}	
?>
                
<div class="modal-header">
											<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
											<h4 class="modal-title"><i class="icon-info"></i>&nbsp;&nbsp;Konfirmasi Transaksi <?php echo $kode ?>&nbsp;-&nbsp;Status : <?php echo $sts; ?></h4>
										</div>
										
                                        
                                      <?php if(!$numc2){ ?>

<div class="modal-body">
	<div class="row">
		<div class="col-md-12">
            <p>
Data Not Found!
			</p>
        </div>
	</div>
</div>   
<?php } else { ?>  
                                        
                                        
                                        
                                        
                                        <div class="modal-body">
                                        <div class="well">
                                       
                                        <li class="media">
                                        <?php echo $gambarw; ?>
                                        <div class="media-body todo-comment">
										<p class="todo-comment-head"><strong>
										<span class="todo-comment-username"><?php echo $namapartner; ?></span> &nbsp; <span class="todo-comment-date">[ user: <?php echo $usernya; ?> ]</span></strong></p><p class="todo-text-color" style="line-height:200%;">Email : <?php echo $emailpartner; ?> | Phone : <?php echo $hppartner; ?><br />Tanggal : <?php echo formatgl($dateconfrm); ?><br />Kode : <?php echo $kode; ?><br />Jumlah : <?php echo rupiah($jumlah); ?><br />Transfer : <?php echo $rektujuan; ?><br />Memo : <?php echo $memo; ?><br />Tanggal dikonfirmasi : <?php echo $tglconfrme; ?>
                                        </div>
                                        </p></div></li>
                                        
                                         <div class="panel-group accordion" id="accordion1">      
                                 <div class="panel panel-default">
									<div class="panel-heading">
										<h4 class="panel-title">
                                        <a aria-expanded="false" class="accordion-toggle collapsed" data-toggle="collapse" data-parent="#accordion1" href="#collapse_1"><button class="btn green" type="button"><i class="fa fa-image"></i>&nbsp;Image Attachment</button></a>
                                        </h4>
									</div>

									<div style="height: 0px;" aria-expanded="false" id="collapse_1" class="panel-collapse collapse">
                                       
                                       <div style="overflow: hidden; position: relative; display: block;" class="pan-container">
            <div style="transform: matrix(1, 0, 0, 1, 25, 10); backface-visibility: hidden; transform-origin: 50% 50% 0px; cursor: move; transition: none 0s ease 0s ;" id="treeview-pan" class="pan-wrap"><div class="tree">
										<?php echo $gambarx; ?>
                                        </div></div>
                                       </div>
										</div>
									</div>
                                        
                                        
                                      
										</div>
                                        
                                        
                                       
                                        </div>
                                        <?php } ?>  
										 
			
                                        <div class="modal-footer">
                                        
											<button type="button" class="btn red" data-dismiss="modal"><i class="fa fa-times"></i>&nbsp;Close</button>
										</div>



<?php
} else if (isset($_GET['do']) && $_GET['do'] == "send") {

$kode = anti_injection($_POST['kode']);		
$rekeningtujuan = anti_injection($_POST['rekeningtujuan']);	
$user = anti_injection($_POST['user']);	
$amount = anti_injection($_POST['amount']);	
$info = anti_injection($_POST['info']);	
$nama = $db->dataku("nama", $user);
$email = $db->dataku("email", $user);
$hp = $db->dataku("hp", $user);

$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=confirm&result=no_pin");
	exit;
} else {
if(!$pincods || $pincods <> $pin) {
	header("location: index.php?go=confirm&result=wrong_pin");
	exit;
} else {
if($lock == 1) {
	header("location: index.php?go=confirm&result=pin_lock");
exit;
	} else {
if($sts == 0) {
	header("location: index.php?go=confirm&result=pin_off");
	exit;
} else {	

	

	$smc2 = mysql_query("SELECT * FROM konfirmasi WHERE kode='".$kode."'");
$cekode2 = mysql_num_rows($smc2);
if($cekode2) {
header("location: index.php?go=confirm&result=confirmed");
	exit;
}else{	


	$img = $_FILES['img1'];
	$allowed =  array('pdf','png','jpg','jpeg','PNG','gif','JPG');//allowed types
$filename = $_FILES['img1']['name'];//file name
$ext = pathinfo($filename, PATHINFO_EXTENSION);//extension checking
if(!empty($_FILES['img1']['name']) && !in_array($ext,$allowed) ){
	header("location: index.php?go=confirm&result=file_error");
	exit;
}else{	
	$type = substr($img['name'], strrpos($img['name'], '.') + 1);
	if(!empty($_FILES['img1']['name']) && $img['size'] > 1000000) {
		header("location: index.php?go=confirm&result=size_error");
	exit;
	} else {
		$time = date("Ymd_His");
        $sess = md5(substr(str_shuffle(str_repeat("ABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789abcdefghijklmnopqrstuvwxyz", 64)), 0, 48));
		$namex = substr($img['name'], 0, strrpos($img['name'], '.'));	
		$special = "confirm";
		$new_file_name = str_replace($namex,'',$special);
		$name  = $new_file_name.'_'.$user_session.'_'.$time.'_'.$sess;
		$thumbName		= $name.'.'.$type;
        if($type == "gif"){
			$imgObj = imagecreatefromgif($img['tmp_name']);
		} else if($type == "png"){
			$imgObj = imagecreatefrompng($img['tmp_name']);
		} else if($type == "jpeg"){
			$imgObj = imagecreatefromjpeg($img['tmp_name']);
		} else if($type == "JPG"){
			$imgObj = imagecreatefromjpeg($img['tmp_name']);
		} else if($type == "PNG"){
			$imgObj = imagecreatefrompng($img['tmp_name']);
		} else {
			$imgObj = imagecreatefromjpeg($img['tmp_name']);
		}
		$width = imageSX($imgObj);
		$height = imageSY($imgObj);
		if(!empty($_FILES['img1']['name']) && !$width || !empty($_FILES['img1']['name']) && !$height) {
		header("location: index.php?go=confirm&result=file_error");
	    exit;
		}else{
		if($width > 1000) {
		 	$height = $height * (1000 / $width);
		 	$width = 1000;	
		}
		$thumbWidth = $width;
		$thumbHeight = $height;
		$newThumb = imagecreatetruecolor($thumbWidth, $thumbHeight);
		imagecopyresampled($newThumb, $imgObj, 0, 0, 0, 0, $thumbWidth, $thumbHeight, imageSX($imgObj), imageSY($imgObj));
		if($type == "gif") {
			imagegif($newThumb, '../images/confirm/'.$thumbName);
		} else if($type == "png") {
			imagejpeg($newThumb, '../images/confirm/'.$thumbName);
		} else {
			imagejpeg($newThumb, '../images/confirm/'.$thumbName);
		}  
		imagedestroy($imgObj);
		imagedestroy($newThumb);

	if(!empty($_FILES['img1']['name'])) {	
	$newfilename = $thumbName;
	}else{
		
   $newfilename = "";
	}
	$ip = $_SERVER['REMOTE_ADDR'];
		
		$db->insert("konfirmasi", "", "'', '$kode', '', '".$nama."', '$user_session', '".$email."', '', '".$amount."', '".mysql_real_escape_string($rekeningtujuan)."', '', '', '$clientdate', '".mysql_real_escape_string($info)."', '$ip', '$hp', '".$invoice."', '', '$newfilename'");
		
		
$db->insert("notifikasi", "", "'', '$user_session', 'Konfirmasi Pembayaran', '', '', 'Anda telah mengirimkan konfirmasi pembayaran kepada administrator untuk pembayaran transaksi ".$kode."', '$clientdate', 'label label-sm label-icon label-info', 'fa fa-info', '0', '$kode'");



		echo "<script>parent.document.location.href ='./index.php?go=confirm&result=success_confirm&co=".base64_encode($kode)."'</script>";
    echo "<script>window.parent.closeModal();</script>";
	exit;
		
	}
}
}
}
}
}
}
}
?>







<?php
}else{


?>

<script>
function isNumberKey(evt){
    var charCode = (evt.which) ? evt.which : event.keyCode
    if (charCode > 31 && (charCode < 48 || charCode > 57))
        return false;
    return true;
}
</script>

<script>
		function confirmActionx2c(){
      var confirmed = confirm("Anda akan mengirimkan konfirmasi ke admin, pastikan informasi yang anda kirimkan benar dan dapat dipertanggung-jawabkan, karena akun anda bisa di blacklist.");
      return confirmed;
}
</script>
<?php      
$initiale = substr(str_shuffle(str_repeat("ABCEFGHIJKLMNPRSTUVWXYZ", 36)), 6, 2);
$stkode = strtotime(date("Y-m-d H:i:s"));
$kodec = $initiale."".$stkode;
?>
<form action="page.php?go=detail_ph&do=send" class="form-horizontal" method="post" enctype="multipart/form-data" onsubmit="return Validate(this);">
<input type="hidden" id="kode" name="kode" value="<?php echo $kodec; ?>" readonly="readonly"/>
<input type="hidden" id="user" name="user" value="<?php echo $user_session; ?>" readonly="readonly"/>

<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true"></button>
	<h4 class="modal-title"><i class="icon-note"></i>&nbsp;&nbsp;Konfirmasi</h4>
</div>

<div class="modal-body">
	<div class="row">
		<div class="col-md-12">
            
            <p>
            
<input type="text" id="amount" class="form-control" name="amount" placeholder="Masukan Jumlah Transfer"  onkeypress="return isNumberKey(event)" required='required' />
			</p>
            <p>
            <select name="rekeningtujuan" id="rekeningtujuan" class="form-control" required='required' >
              <option value="" selected="selected">
              [ Pilih Rekening Tujuan ]            </option>
			     
      
         <?
	 $rekbank = $db->config("rekbank");
	  if($rekbank == 1) {
		
	  if($bank) { echo " <option value='".$bank."'>".$bank."</option>";}
	  if($bank1) { echo " <option value='".$bank1."'>".$bank1."</option>";}
	  if($bank2) { echo " <option value='".$bank2."'>".$bank2."</option>";}
	  if($bank3) { echo " <option value='".$bank3."'>".$bank3."</option>";}
	  }
		?>
          
          
		  </select>
            </p>
           
          <p>
            <textarea name="info" class="form-control" id="info" placeholder="Masukan Informasi jika ada"></textarea>
               
			</p>
            <p>
        <div class="fileinput fileinput-new" data-provides="fileinput">
												<div class="input-group input-large">
													<div class="form-control uneditable-input input-fixed input-medium" data-trigger="fileinput">
														<i class="fa fa-file fileinput-exists"></i>&nbsp; <span class="fileinput-filename"></span>
													</div>
													<span class="input-group-addon btn default btn-file">
													<span class="fileinput-new">
													Select file </span>
													<span class="fileinput-exists">
													Change </span>
													<input name="img1" type="file" id="img1">
													</span>
													<a href="javascript:;" class="input-group-addon btn red fileinput-exists" data-dismiss="fileinput">
													Remove </a>
												</div>
											</div>
										
			</p>
           
      <p>
				<input type="password" class="form-control" placeholder="Masukan PIN" name="pincode" id="pincode" required='required'>
               
			</p>
			
		</div>
	</div>
</div>
<div class="modal-footer">
	<button type="submit" class="btn green" name="unlocknow" <?php echo $diss; ?> <?php echo $diss2; ?> <?php echo $diss3; ?> onclick="return confirmActionx2c()"><i class="fa fa-check-square-o"></i>&nbsp;Submit</button>
	 <button type="button" class="btn red" data-dismiss="modal"><i class="fa fa-times"></i>&nbsp;Cancel</button>
</div>


</form>
<script type="text/javascript">
var _validFileExtensions = [".jpg", ".jpeg", ".gif", ".png", ".pdf"];

function Validate(oForm) {
    var arrInputs = oForm.getElementsByTagName("input");
    for (var i = 0; i < arrInputs.length; i++) {
        var oInput = arrInputs[i];
        if (oInput.type == "file") {
            var sFileName = oInput.value;
            if (sFileName.length > 0) {
                var blnValid = false;
                for (var j = 0; j < _validFileExtensions.length; j++) {
                    var sCurExtension = _validFileExtensions[j];
                    if (sFileName.substr(sFileName.length - sCurExtension.length, sCurExtension.length).toLowerCase() == sCurExtension.toLowerCase()) {
                        blnValid = true;
                        break;
                    }
                }

                if (!blnValid) {
                    alert("Sorry, " + sFileName + " <?php echo $LANG["fotoproinfo2d"]?> : " + _validFileExtensions.join(", "));
                    return false;
                }
            }
        }
    }

    return true;
}
</script>	

<?php } } ?>
