<?php
	//Source => http://www.infragistics.com/community/blogs/taz_abdeali/archive/2012/02/08/netadvantage-for-jquery-with-php-101.aspx
	//Cek metode
	$metode = $_SERVER['REQUEST_METHOD'];

	//aktifkan session
	if(!isset($_SESSION)){session_start();}

	//open connection
	include ('connect-DB.php');

	if ($metode=="POST"){
		$idx			=isset($_POST['id'])	? $_POST['id'] : "";
	}else{
		$idx			=isset($_GET['id'])	? $_GET['id'] : "";
	}

	//parameter utk search 
	$wherex ="1=1";
	$idx2=decrypt($idx);

	$qstring="
		SELECT * from `hensap`.`absen_user` 
		WHERE id='$idx2'
	";

	//$wherex=$qstring;
	//include("LogCekVar.php");
	//echo $idx;
	//die();

	$rs = mysqli_query($conn_login,$qstring); 
	while ($rowx = mysqli_fetch_array($rs,MYSQLI_ASSOC)){
		$namax=$rowx["nama"];
	}

	function decrypt( $q ) {
		$cryptKey  = 'qJB0rGtIn5UB1xG03efyCp';
		$q=str_replace("plus","+",$q);
		$q=str_replace("slashL","/",$q);
		$q=str_replace("slashR","\\",$q);
		$q=str_replace("min","-",$q);
		$q=str_replace("bagi",":",$q);
		$q=str_replace("sama","=",$q);
		$q=str_replace("kali","*",$q);
		$qDecoded      = rtrim( mcrypt_decrypt( MCRYPT_RIJNDAEL_256, md5( $cryptKey ), base64_decode( $q ), MCRYPT_MODE_CBC, md5( md5( $cryptKey ) ) ), "\0");
		return( $qDecoded );
	}
?>


<!DOCTYPE html> 
<html>

<link rel="stylesheet" type="text/css" href="./easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="./easyui/themes/icon.css">
<link rel="stylesheet" type="text/css" href="./easyui/demo.css">
<script type="text/javascript" src="./easyui/jquery.min.js"></script>
<script type="text/javascript" src="./easyui/jquery.easyui.min.js"></script>

<script type='text/javascript'>
	function konfirm(){
			$.ajax({
			type: "POST", //$(this).attr('method'), 
			url:"pegawaiFunc.php",//$(this).attr('action'),
			data: $("#frm_konfirm").serialize(), //"kunci=John&submit=Boston",
			dataType: "json",  //hanya di pasang jika data php menggunakan json
			//beforeSend: function(){
			//	$('#loading').show();
			//},
			success: function(data) {
				//alert (data.isimsg);
				document.getElementById("isian").innerHTML=data.isimsg;
			},
			error : function() {
				alert("Error... Please Cek URL - Data gagal di Proses!!!.");
			},
			complete: function() {
				//alert("Complete Proses!!!.");						
			}					
			});				
	}
</script>

<body>
	<div id='isian'>
		<form id="frm_konfirm" name="frm_konfirm" >
			<h1> <?php echo $namax;?> akan absen, password </h1>
			<input id='kunci'  name='kunci' type='hidden' value='HariIni' >
			<input id='id'  name='id' type='hidden' value=<?php echo $idx;?> >
			<input id='konfirmasi'  name='konfirmasi' type='password' style='width:180px;line-height:16px;border:1px solid #ccc'>
			<input id='bkonfirmasi' name='bkonfirmasi' type='button' onClick='konfirm();' value='Ok'>
		</form>
	</div>
</body>
</html>