<?php
    session_cache_expire(1440);
	session_start();
        session_name("insys");
        include "include/config.php";
        include "include/functions.php";
        include "class/UctVw.php";
        
    if($_REQUEST['ajax']) {
         $ssql="SELECT count(fnid) as jml
                FROM tluser
                WHERE ftusername='".base64_decode($_REQUEST['usern'])."'
                        AND ftpassword='".base64_decode($_REQUEST['pass'])."' ";
      
        $rs=mysql_query($ssql);
        $r=mysql_fetch_assoc($rs);
        if($r['jml']!=0) {
              
                $_SESSION['usernameApprove']=base64_decode($_REQUEST['usern']);
                if(GetSecurityApprove($_REQUEST['menu']))  {
                     echo "Post();";

                }
                else {
                    echo "alert('Anda tidak punya hak akses..');";
                }
              
        }
        else {
             echo " alert('Login gagal ...');";
        }
        die("");
         
    }

?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head><title>:: Approve ::</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<!---->
<style type="text/css">
@import url(css/admin_login.css);
</style>
<script type="text/javascript" src="script/script.js"></script>
<script type="text/javascript" src="script/ajax.js"></script>
<script type="text/javascript" src="script/ajax2.js"></script>
<script language="javascript" type="text/javascript">
   

    function Post() {
        //window.openDialog(url, name, features, arg1, arg2)
        var gContainer=window.opener;
        var m="<?php echo base64_decode($_REQUEST['m']); ?>";
        gContainer.ftest(m);
        window.close();
    }
    
    
	function setFocus() {
		document.form.txtUserName.select();
		
	}
    function ValLogin() {
        var usern=base64_encode(document.form.txtUserName.value);
        var pass=base64_encode(document.form.txtPassword.value);
        //alert('<?php echo $_SERVER["PHP_SELF"]; ?>?ajax=1&usern='+usern+'&pass='+pass+'&menu=<?php echo $_REQUEST['menu']; ?>');
        ajax_do('approval.php?ajax=1&usern='+usern+'&pass='+pass+'&menu=<?php echo $_REQUEST['menu']; ?>');
        
        return false;
    }
</script>
</head>

<body onload="setFocus();">
	<form name="form" action="login.php" method="post" onSubmit="return ValLogin();">

		<div id="ctr" align="center">
				
				<div class="login-form">
					<img src="images/login.gif" alt="Login" />
					<form action="index.php" method="post" name="loginForm" id="loginForm">
					<div class="form-block">
						<div class="inputlabel">Username</div>
						<div><input id='txtUserName' name="txtUserName" type="text" class="inputbox" size="15" onKeyPress="return handleEnter(this, event)" /></div>
						<div class="inputlabel">Password</div>
						<div><input id='txtPassword' name="txtPassword" type="password" class="inputbox" size="15" /></div>
						<div align="left"><input type="submit" name="btnLogin" class="button" value="Login" onKeyPress="return handleEnter(this, event)" />&nbsp;<input type="button" name="btnKeluar" class="button" value="Keluar" onClick="window.close();" onKeyPress="return handleEnter(this, event)" />&nbsp;<input type="reset" name="btnReset" class="button" value="Reset" onKeyPress="return handleEnter(this, event)" /></div>
					</div>
					</form>
				</div>
				<div class="login-text">
					<div class="ctr"><img src="images/security.png" width="64" height="64" alt="security" /></div>
					<p>Masukan User Dan Password untuk Proses Approve</p>
					
				</div>
				<div class="clr"></div>
			</div>
		</div>
		
	</form>
</body>