<?php
//error_reporting(0);
include('database.php');
session_start();
//extract($_SESSION);
extract($_GET);
extract($_POST);

if(isset($_GET['page'])){ $content=$_GET['page']; }else{ $content=""; }

if ($content==''){
$content='mydetails';
}elseif(!file_exists('inc/'.$content.'.php')){
   $content='404'; 
}

if(isset($_GET["i"])){
		$applicant_idgdef = $_GET["i"];
	}

if($applicant_idgdef==''){
    echo '<script>window.location = "startapplication.php";</script>';
    //header("Location:startapplication.php");
}else{
	//fix error
	if(($content=='mydetails') && isset($_GET["i"])){
		$applicant_idgdef = $_GET["i"];
	}
	///
	$qry = mysqli_query ($con, "SELECT * FROM prob_application WHERE id=$applicant_idgdef");
    while ($row = mysqli_fetch_array($qry)){
        
        $username=$row['memberSurname'];
        $status=$row['status'];
		$previewurl = "index.php?page=preview&i=".$applicant_idgdef;
			
		
        if(($status!="Pending")&&($content!='preview')){ echo '<script>window.location = "'.$previewurl.'";</script>'; }
    } 
}


?>


<!DOCTYPE HTML>
<html>
<head>
<title>NIQS GDE Registration</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="keywords" content="" />
<script type="application/x-javascript"> addEventListener("load", function() { setTimeout(hideURLbar, 0); }, false); function hideURLbar(){ window.scrollTo(0,1); } </script>
 <!-- Bootstrap Core CSS -->
<link href="css/bootstrap.min.css" rel='stylesheet' type='text/css' />
	<!-- Custom CSS -->
<link href="css/style.css" rel='stylesheet' type='text/css' />
	<!-- Graph CSS -->
<link href="css/font-awesome.css" rel="stylesheet"> 
	<!-- jQuery -->
<link href='//fonts.googleapis.com/css?family=Roboto:700,500,300,100italic,100,400' rel='stylesheet' type='text/css'>
	<!-- lined-icons -->
<link rel="stylesheet" href="css/icon-font.min.css" type='text/css' />
	<!-- /js -->
<script src="js/jquery-1.10.2.min.js"></script>
<!-- //js-->

</head> 
<body>
   <div class="page-container">
   <!--/content-inner-->
	<div class="left-content">
	   <div class="inner-content">
		<!-- header-starts -->
			<div class="header-section" style="background-color:black">
						<!--menu-right-->
						<div class="top_menu">
						        
							<!--/profile_details-->
								<div align="center" class="profile_details_left" style="alignment-adjust: central; width: 100%;">
									<font color="white">
									<h1>THE NIGERIAN INSTITUTE OF QUANTITY SURVEYORS</h1>
									<font size='5'> Probation Examination Registration</font>
									</font>
							<div class="clearfix"></div>	
							</div>
							<div class="clearfix"></div>	
							<!--//profile_details-->
						</div>
						<!--//menu-right-->
					<div class="clearfix"></div>
				</div>
					<!-- //header-ends -->
						<!--outter-wp-->
							<div class="outter-wp">
									
									<?php 
                                    include('inc/'.$content.'.php');
                                    ?>
										<!--//graph-visual-->
									</div>
									<!--//outer-wp-->
									 <!--footer section start-->
										<footer style="background-color:black; width:100%"> 
										   <p>&copy  <?php echo date('Y'); ?>. All Rights Reserved </p>
										</footer>
									<!--footer section end-->
								</div>
							</div>
				<!--//content-inner-->
			<!--/sidebar-menu-->
				<div class="sidebar-menu">
					<header class="logo">
					<a href="#" class="sidebar-icon"> <span class="fa fa-bars"></span> </a> <a href="index.php"> <span id="logo"><h1><?php echo $username; ?></h1></span> 

				  </a> 
				</header>
			<div style="border-top:1px solid rgba(69, 74, 84, 0.7)"></div>
			<!--/down-->
							
							   <!--//down-->
								<div class="menu">
									<ul id="menu" >
                                    	<!--li><a href="index.php?page=home"><i class="fa fa-tachometer"></i> <span>Dashboard</span></a></li-->
										<!--li><a href="index.php?page=mydetails"><i class="fa fa-edit"></i> <span>Personal Details</span></a></li-->
										 
										<?php
										 if($status=="Pending")
										 {
											 //allow edit
											 /*
											 ?>
										 <li><a href="index.php?page=passport"><i class="fa fa-edit"></i> <span>Passport</span></a></li>
                                         <li><a href="index.php?page=education"><i class="fa fa-edit"></i> <span>Education</span></a></li>
                                         <li><a href="index.php?page=body"><i class="fa fa-edit"></i> <span>Professional Body</span></a></li>
                                         <li><a href="index.php?page=tpc"><i class="fa fa-edit"></i> <span>TPC</span></a></li>
                                         <li><a href="index.php?page=logbook"><i class="fa fa-edit"></i> <span>Logbook</span></a></li>
                                         <li><a href="index.php?page=gde"><i class="fa fa-edit"></i> <span>GDE</span></a></li>
                                         <li><a href="index.php?page=exemption"><i class="fa fa-edit"></i> <span>Exemption</span></a></li>
                                         <li><a href="index.php?page=experience"><i class="fa fa-edit"></i> <span>Work Experience</span></a></li>
                                         <li><a href="index.php?page=employer"><i class="fa fa-edit"></i> <span>Employer</span></a></li>
                                         <li><a href="index.php?page=sponsor"><i class="fa fa-edit"></i> <span>Sponsor</span></a></li>
										 <li><a href="index.php?page=preview"><i class="fa fa-search"></i> <span>Preview/Submit</span></a></li>
                                         
										 <?php 
										 */ } ?>
                                         <!--li><a href="index.php?page=password"><i class="fa fa-edit"></i> <span>Channge Password</span></a></li-->
										<li><a href="logout.php"><i class="fa fa-sign-out"></i> <span>Log Out</span></a></li>
								  </ul>
								</div>
							  </div>
							  <div class="clearfix"></div>		
							</div>
							<script>
							var toggle = true;
										
							$(".sidebar-icon").click(function() {                
							  if (toggle)
							  {
								$(".page-container").addClass("sidebar-collapsed").removeClass("sidebar-collapsed-back");
								$("#menu span").css({"position":"absolute"});
							  }
							  else
							  {
								$(".page-container").removeClass("sidebar-collapsed").addClass("sidebar-collapsed-back");
								setTimeout(function() {
								  $("#menu span").css({"position":"relative"});
								}, 400);
							  }
											
											toggle = !toggle;
										});
							</script>
<!--js -->
	<script src="js/jquery.nicescroll.js"></script>
	<script src="js/scripts.js"></script>
<!-- Bootstrap Core JavaScript -->
   <script src="js/bootstrap.min.js"></script>
</body>
</html>