<?php session_start();
include("connect.php");
if(isset($_GET['cancel'])){
	unset($_SESSION['matric_no']);
	unset($_SESSION['semester_id']);
	header("location:slip_verification.php");
}
/*if(isset($_GET['close'])){
	unset($_SESSION['matric_no']);
	unset($_SESSION['semester_id']);
} */
?>
<!DOCTYPE html>
<html lang="en">
	<head>
		<meta charset="UTF-8" />
		<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		 <title>Exam Slip Verification:: Inspire Polytechnic, Course Registration Portal</title>
   <meta name="description" content="Inspire Polytechnic, Course Registration Portal" />
	<meta name="keyword" content="Inspire Polytechnic, Course Registration, Portal, Studies, Education" />
	<meta name="author" content="Dosumu Ololade"/>
    <link rel="icon" href="img/lasu_logo.png">
		
		<!-- vector map CSS -->
		<link href="vendors/bower_components/jasny-bootstrap/dist/css/jasny-bootstrap.min.css" rel="stylesheet" type="text/css"/>
		<!-- Custom CSS -->
		<link href="dist/css/style.css" rel="stylesheet" type="text/css">
		
	</head>
	<body style="background-color:white;">

		
		<div class="wrapper pa-0">
			<header class="sp-header">
				<div class="sp-logo-wrap pull-left">
					<a href="slip_verification.php">
						<img class="brand-img mr-10" style="width:40px;" src="img/lasu_logo.png" alt=""/>
					</a>
				</div>
				<div class="form-group mb-0 pull-right">
					<span class="inline-block pr-10" style="color:black;font-weight:600;">Inspire Polytechnic</span>
				</div>
				<div class="clearfix"></div>
			</header>
			
			<!-- Main Content 
			https://www.'.$lasu_link.'slip_verification.php?id='.$me['matric_no'].'&pid='.uniqid().'&duo='.$opp['id'];
			
			
			echo '<br><br><div class="row">
					<div class="col-lg-12 col-xs-12">
					
					<div class="panel panel-default card-view">
					<div class="panel-wrapper collapse in">
					<div class="panel-body" align="center">
					
					<div class="row">
					<div class="col-md-3"></div>
					<div class="col-md-6" style="border:1px solid #ffd480; margin:20px; padding-top:14px;">
					<br><h1 style="font-size:100px;color:#ffaa00;">&#9888;</h1><br>
					<div style="margin-bottom:30px; margin-top:; font-weight:400;"><h2 style="font-size:20px; color:#e69900;"><span style="font-weight:900;font-size:27px;">ERROR!</span> '.ucwords(strtolower($my['sname'])).' did not enrol for any '.$seme['session'].' '.$seme['description'].' course.</h2>
					<p style="text-align:center;font-size:18px;"><span style="color:black;">Conclusion: </span>Student not eligible for this exam...</p>
					</div>
					</div>
					
					<div class="col-md-3"></div>
					
					</div>
					
					
					</div>
					</div>
					</div>
					
					</div>
					</div>';
			
			-->
			
			<?php
			if((isset($_GET['id'])) && (isset($_GET['duo'])) && (isset($_GET['pid']))){
				$ban=mysqli_query($con,"select * from student where matric_no='".$_GET['id']."'");
				$bon=mysqli_query($con,"select * from semester where id='".$_GET['duo']."'");
				if((mysqli_num_rows($ban)>0) && (mysqli_num_rows($bon)>0)){
					
					echo '<div class="main_form">
					<div class="page-wrapper pa-0 ma-0 auth-page main_form">
				<div class="container-fluid">
					<!-- Row -->
					<div class="table-struct full-width full-height">
						<div class="table-cell vertical-align-middle auth-form-wrap">
							<div class="auth-form  ml-auto mr-auto no-float">
								<div class="row">
									<div class="col-sm-12 col-xs-12">
										<div class="mb-30">
											<h3 style="font-weight:600; font-size:28px;" class="text-center txt-dark mb-10">Student Exam Slip Verification</h3><br>
											<!--<h6 class="text-center nonecase-font txt-grey">Enter your details below</h6>-->
										</div>	
										<div class="form-wrap" style="padding:30px; box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);">
											<form id="form_submit" method="post">
									<input type="hidden" name="verify_slip" value="true">
									<input type="hidden" name="matric_no" value="'.$_GET['id'].'">
									<input type="hidden" name="semester_id" value="'.$_GET['duo'].'">
									<input type="hidden" name="programme_id" value="'.$_GET['pid'].'">
												<div class="form-group">
													<label class="pull-left control-label mb-10" for="exampleInputpwd_2">Access Password</label>
													<input type="password" name="password" class="form-control" placeholder="Enter Verification Password" required>
												</div>
												<div class="msg"></div>
												<div class="form-group text-center">
													<button type="submit" class="pull-right btn btn-info btn-primary">Submit</button>
													<div class="clearfix"></div>
												</div>
											</form>
										</div>
									</div>	
								</div>
							</div>
						</div>
					</div>
					<!-- /Row -->	
				</div>
				
			</div></div>';
					
					
				}else{ 
					echo '<br><br><div class="row">
					<div class="col-lg-12 col-xs-12">
					
					<div class="panel panel-default card-view">
					<div class="panel-wrapper collapse in">
					<div class="panel-body" align="center">
					
					<div class="row">
					<div class="col-md-3"></div>
					<div class="col-md-6" style="border:1px solid #ffd480; margin:20px; padding-top:14px;">
					<br><h1 style="font-size:100px;color:#ffaa00;">&#9888;</h1><br>
					<div style="margin-bottom:30px; margin-top:; font-weight:400;"><h2 style="font-size:20px; color:#e69900;"><span style="font-weight:900;font-size:27px;">ERROR!</span> Invalid Exam Slip.</h2>
					<p style="text-align:center;font-size:18px;"><span style="color:black;">Conclusion: </span>Slip might have been forged...</p>
					</div>
					</div>
					
					<div class="col-md-3"></div>
					
					</div>
					</div>
					</div>
					</div>
					
					</div>
					</div>';
				}
				
			}else{ 
			
			echo '<br><br><div class="row">
					<div class="col-lg-12 col-xs-12">
					
					<div class="panel panel-default card-view">
					<div class="panel-wrapper collapse in">
					<div class="panel-body" align="center">
					
					<div class="row">
					<div class="col-md-3"></div>
					<div class="col-md-6" style="border:1px solid #ffd480; margin:20px; padding-top:14px;">
					<br><h1 style="font-size:100px;color:#ffaa00;">&#9888;</h1><br>
					<div style="margin-bottom:30px; margin-top:; font-weight:400;"><h2 style="font-size:20px; color:#e69900;"><span style="font-weight:900;font-size:27px;">OH NO!</span> Why are you here?</h2>
					<p style="text-align:center;font-size:18px;"><span style="color:black;">Conclusion: </span> It seems you miss your way...</p>
					</div>
					</div>
					
					<div class="col-md-3"></div>
					
					</div>
					
					</div>
					</div>
					</div>
					
					</div>
					</div>';
			
	}
				
				//////////////////////////// end to display result
				
			
			
			?>
			<!-- /Main Content -->
		
		</div>
		</div>
		<!-- /#wrapper -->
		
		<!-- JavaScript -->
		
		<!-- jQuery -->
		<script src="vendors/bower_components/jquery/dist/jquery.min.js"></script>
		
		<script>
		$(document).ready(function(){
			$("form#form_submit").on('submit',(function(e){
			e.preventDefault();
			$("div.msg").html("<p class='text-primary' style='padding:5px; text-align:center;'><i class='fa fa-spin fa-spinner'></i> Processing Request...</p>");
				$.ajax({
						type: "POST",
                        url: "operation.php",
                        data: new FormData(this),
						contentType:false,
						processData:false,
                        cache: false,
                        success: function(data){ 
						
						if(data.indexOf("Invalid verification password.")> -1){
							$("div.msg").html('<div class="alert alert-dismissible alert-danger">\
				<strong>Oh No!</strong> Invalid verification password.\
              </div>');
							
						}else if(data.indexOf("Result Unknown, kindly re-scan Qrcode.")> -1){
							$("div.msg").html('<div class="alert alert-dismissible alert-danger">\
				<strong>Oh Sorry!</strong> Result Unknown, kindly re-scan exam slip Qrcode.\
              </div>');
			  
						}else if(data.indexOf("Student did not register any course for this semester.")> -1){
							$("div.main_form").html('<br><br><div class="row">\
					<div class="col-lg-12 col-xs-12">\
					<div class="panel panel-default card-view">\
					<div class="panel-wrapper collapse in">\
					<div class="panel-body" align="center">\
					<div class="row">\
					<div class="col-md-3"></div>\
					<div class="col-md-6" style="border:1px solid #ffd480; margin:20px; padding-top:14px;">\
					<br><h1 style="font-size:100px;color:#ffaa00;">&#9888;</h1><br>\
					<div style="margin-bottom:30px; margin-top:; font-weight:400;"><h2 style="font-size:20px; color:#e69900;"><span style="font-weight:900;font-size:27px;">OH NO!</span> Student did not enrol for any course in this current semester.</h2>\
					<p style="text-align:center;font-size:18px;"><span style="color:black;">Conclusion: </span> Any claim of student\'s course registration is false...</p>\
					</div></div>\
					<div class="col-md-3"></div>\
					</div></div></div>\
					</div></div></div>');
			  
						}else{
							$("div.main_form").html(data);
						}
						
						
                        } 
				});
			
		}));
			

		});
		</script>
		
		<!-- Bootstrap Core JavaScript -->
		<script src="vendors/bower_components/bootstrap/dist/js/bootstrap.min.js"></script>
		<script src="vendors/bower_components/jasny-bootstrap/dist/js/jasny-bootstrap.min.js"></script>
		
		<!-- Slimscroll JavaScript -->
		<script src="dist/js/jquery.slimscroll.js"></script>
		
		<!-- Init JavaScript -->
		<script src="dist/js/init.js"></script>
	</body>
</html>
