<?php
include 'connect/cms-config.php' ;
include 'requires/function.php' ;
include 'requires/session.php' ;

// include the class
include 'requires/class_resize.php' ;

// keep parameter in value
$type = escapeString($_GET['type']) ;
$prev_url = base64_decode(escapeString($_GET['pu']));

//check password
$mysqli_ck_password = $mysqli->query("SELECT a.password_id, a.content FROM app_password a LEFT JOIN app_password_translation b ON ( a.password_id = b.password_id ) WHERE a.deleted_at IS NULL AND a.password_type = '".$type."' AND b.lang = 'en'");
if ($mysqli_ck_password->num_rows > 0) {
	$row_ck_password = $mysqli_ck_password->fetch_array();
}

include 'requires/page_header.php';
include 'requires/page_top.php';
?>

	<div class="warper container-fluid">   	
		<div class="page-header"><h1>Password Checking (<?= strtoupper($type) ?>) <small><?= $lang[$page_mode] ?></small></h1></div>
		<div class="panel panel-default">
            <div class="panel-heading"></div>
            <div class="panel-body">
            	<form method="post" class="form-horizontal" id="quotationForm" enctype="multipart/form-data" action="<?= $prev_url ?>" novalidate="novalidate">
            		<div class="form-group">
                        <div class="col-sm-2 control-label"><?= ucfirst($type) ?> Password</div>
                        <div class="col-sm-9">
                        	<span id="ck_pass" style="position:absolute; right: 30px; font-size:20px;"><i class="fa fa-eye" aria-hidden="true" title="Click and Hold to Check Password"></i></span>
                            <input type="password" name="password_inserted" id="password" class="form-control ui-search-input" placeholder="Password" required="required" >
                        </div>
                    </div>
                    <div class="form-group">
                        <div class="col-sm-2 control-label"></div>
                        <div class="col-sm-9">
                            <button type="submit" class="btn btn-purple" style="float:right"><?= $lang['submit'] ?></button>
                            <input type="hidden" name="hide" value="1">
                            <input type="hidden" name="page_status" value="<?= $submit_type ?>">
                        </div>
                    </div> 
            	</form>
            </div>
        </div>
	</div>
	<script>
		$("#ck_pass").mouseleave(function(){
			if ($("#password").prop("type") == 'text') {
				$("#password").prop("type", "password");
			}
		});
		$("#ck_pass").on('mousedown', function(){
			$("#password").prop("type", "text");
		});

		$("#ck_pass").on('mouseup', function(){
			$("#password").prop("type", "password");
		});
	</script>

<?php
include 'requires/page_footer.php' ;
?>