<?php include("auth.php");?>

<?php
require("dbcon.php");
error_reporting( ~E_NOTICE );
session_start();
if(isset($_POST["btn-sub"])){
    $email= $_POST['email'];
    $pin = $_POST['pin'];
    $sql ="SELECT * FROM user WHERE email ='$email' and pin='$pin'";
    $result = mysqli_query($db,$sql);
    $rows = mysqli_num_rows($result);
    if($rows> 0){
        
        echo '<script>
         setTimeout(function(){
            window.location.href = "withdraw.php";
         }, 2000);
      </script>';
      $status ="";
        $status = "<p style='color:green'> Pin Correct  redirecting....</p>";
     
    }else {
        $status ="";
        $status = "<p style='color:red'>Incorrect Pin.</p>".mysqli_error($db);
    }
}
?>

<html>
    <head>
        <title>Enter Pin</title>
    </head>
<body>
    
    <style type="text/css">
        body{
	margin: 0;
	font-family: 'Quicksand', sans-serif;
}

a{
	text-decoration: none;
	letter-spacing: inherit;
	transition: all 0.23s ease-in-out 0s;
}a:hover{
	letter-spacing: 5px;
}

.wrap{
	position: absolute;
	width: 100%;
	height: 100%;
	background: #897AC5;
	background: linear-gradient(141deg, #0fb8ad 0%, #1fc8db 51%, #2cb5e8 75%);
}

.box{
	position: relative;
	width: 370px;
	margin: 0 auto;

	background: #212F3D;
	top: 50%;
	transform: translate(0%, -50%);
	box-shadow: 0px 5px 25px rgba(72, 72, 72, 0.5);
}

.pinHeader{
	text-align: center;
	color: #5D6D7E;
	padding: 5px;
	background: #293A4B;
}

.bullets-color{
	position: absolute;
	width: 10px;
	height:10px;

	cursor: pointer;
	float: left;
	margin-left: 10px;
	margin-top: 20px;
	border-radius: 15px;
} 

.c-red{
	background: #E74C3C;
	margin-left: 10px;
}
.c-yellow{
	background: #F4D03F;
	margin-left: 30px;
}
.c-green{
	background: #58D68D;
	margin-left: 50px;
}

.pinBody{
	text-align: center;
	color: #5D6D7E; 
	padding: 35px 95px;
	height: 225px;
	opacity: 1;
	
	transition: all 0.23s ease-in-out 0s;
}

.height0{
	height: 0px;
}

.width0{
	width: 80px;
}

.hide{
	opacity: 0;
}

input[type="password"]{
	width: 100%;
	height: 40px;
	border: 2px solid #5D6D7E;
	box-sizing: border-box;
	border-radius: 3px;
	background: transparent;
	color: #5D6D7E;
	text-align: center;
	font-weight: 600;
	font-size: 17px;
	box-shadow: 0px 5px 25px rgba(72, 72, 72, 0.0);
	transition: all 0.23s ease-in-out 0s;
}input[type="password"]:focus{
	outline: none;
	box-shadow: 0px 5px 25px rgba(52, 73, 94  , 0.5);
}

.txt-description{
	align-text: center;
	font-size: 12px;
}


.pinBottom{
	position: absolute;
	width: 100%;
	bottom: 0;
	text-align: center;
	padding: 25px 0;
	color: #fefefe;
	background: #223456;
}.pinBottom:hover{
	background: #38507E;
}





/**/
    </style>
<div class="wrap">
	
	<div class="box">
		
		<div class="pinBox">
			
			<section class="pinHeader">
				
				<div class="bullets-color c-red"></div>
				<div class="bullets-color c-yellow"></div>
				<div class="bullets-color c-green"></div>
				
				<p>PayPass</p>
			</section>
			
			<section class="pinBody">
				<div class="pinBodyContent">
				    <form method="POST" action="">
				        <p><?php echo $status;?></p>
					<p>Enter your PIN</p>
					<input type="password" name="pin">
					<input type="hidden"   value="<?php echo $_SESSION["email"];?>" name="email">
					<p class="txt-description">Please enter your pin to Withdraw.</p>
				</div>
			</section>
			<br><br>
			<section class="">
				<button class="pinBottom" style="border:none;"type="submit" name="btn-sub" ><span style="font-size:20px;">Continue</span></button>
			</section>
			</form>
			
		</div>
		
	</div>
	
</div>

<script type="text/javascript">

    $('.c-yellow').click(function() {
	$(".pinBody").toggleClass( "height0");
	$(".pinBodyContent").toggleClass( "hide");
});

$('.c-red').click(function() {
	$(".pinBody").toggleClass( "height0");
	$(".pinBodyContent").toggleClass( "hide");
	$("p").toggleClass( "hide");
	$(".pinBodyContent").toggleClass( "hide");
	$(".box").toggleClass( "width0");
});
</script>

</body>
</html>