<?php
session_start();
require 'database.php';

$centre = $_GET['centre'];
$myexam = $_GET['myexam'];
$diet= $_GET['diet'];
?>

<html>
<head>
<title>
	Professional Examinations Information
</title>
<style type="text/css">
hr {
 margin-left: auto;
 margin-right: auto;
 margin-top: 0px;
 margin-bottom: 0px;
 background-color: black;
}
</style>
</head>
<body style="width:90%; background-color:white; margin:10px;">

<?php

//print_r($_GET);

//Create query 
//$q = "SELECT * FROM examcard WHERE diet='$diet' AND centre='$centre' AND examType='$examType'";
//$q = "SELECT * FROM examcard WHERE diet='' ORDER BY centre ASC";
//$q = "SELECT * FROM examcard WHERE memberNo='P00371I' ORDER BY centre ASC";
$q = "SELECT * FROM examcard WHERE diet='$diet' AND centre='$centre' AND examType like '$myexam%' ORDER BY centre ASC";
$r = mysqli_query($con, $q);


if($r){
 while($rows = mysqli_fetch_array($r))
 {
   extract($rows);
   
  //EXAM NAME
	   
	   if($examType == "TPC FULL"){ $examName = "TEST OF PROFESSIONAL COMPETENCE "; $examfile = "tpcfull"; $examdb = "tpcf_application"; }
	   if($examType == "TPC REFERRAL"){ $examName = "TEST OF PROFESSIONAL COMPETENCE "; $examfile = "tpcref"; $examdb = "tpcr_application"; }
	   if($examType == "GDE FULL"){ $examName = "GRADUATESHIP EXAMINATION "; $examfile = "gdefull"; $examdb = "gdef_application";}
	   if($examType == "GDE REFERRAL"){ $examName = "GRADUATESHIP EXAMINATION "; $examfile = "gderef"; $examdb = "gder_application";}
	   if($examType == "PCI"){ $examName = "PROFESSIONAL COMPETENCE INTERVIEW "; $examfile = "pci"; $examdb = "pci_application";}
	   if($examType == "PROBATION FULL"){ $examName = "PROBATION EXAMINATION "; $examfile = "probation"; $examdb = "prob_application";}
	   
	   
	   
	   //PASSPORT FILE
	   $qp = "SELECT * FROM ".$examdb." WHERE regSet='$diet' AND memberNo='$memberNo'";
	   
	   $rp = mysqli_query($con2, $qp);
	   if($rp){ 
	   
	    while($rowp = mysqli_fetch_array($rp)){ $applicantId = $rowp['id'];} 
	   }
	
	   $mypassport = "https://register.niqs.org.ng/".$examfile."/passport/".$memberNo."_".$applicantId.".jpg";
	
   
echo "<img src='https://niqs.org.ng/logbookresult/NIQS_banner2.jpg' height='200px'> <br><br><br> <br> <center><font size='6' face='arial black'> ".str_replace(", ", " ", $diet)." PROFESSIONAL EXAMINATIONS </font><br><br></center>";
   echo "<table width='90%' align='center'>";
   
   
   echo "<tr><td><font size='4' face='arial black'> NAME: <br> </font></td> <td align='left' width='80%'> &nbsp; <font size='4' face='arial black'> ".$memberNames." </font> <hr></td>  </tr>";
  
   echo "<tr><td><font size='4' face='arial black'> EXAM STAGE: <br> </font></td> <td align='left'> &nbsp; <font size='4' face='arial black'> ".$examName."(".$examType.") </font> <hr></td> </tr>";
   
   if(strlen($division)>0){
   	echo "<tr><td><font size='4' face='arial black'> DIVISION: <br> </font></td> <td align='left'> &nbsp; <font size='4' face='arial black'> ".$division." </font> <hr></td> </tr>";
   }
   
   echo "<tr><td><font size='4' face='arial black'> CENTRE: <br> </font></td> <td align='left'> &nbsp; <font size='4' face='arial black'> ".$centre." </font> <hr></td> </tr>";
   echo "<tr><td><font size='4' face='arial black'> EXAM NO: <br> </font></td> <td align='left'> &nbsp; <font size='4' face='arial black'> ".$examNo." </font> <hr></td> </tr>";
   
   echo "</table>";
   
  
   
   echo "<center><table width='110%' border='0'><tr><td width='10%'><img src='".$mypassport."' width='200px'> <br><br> </td><td width='90%'><font size='4' face='arial'><b> <br><br>  ".str_replace(", ", " ", $diet)." PROFESSIONAL EXAMINATIONS TIME TABLE </b><br> </font>";
   
    $mytable=str_replace(",", "", $diet);
    $mytable=str_replace(" ", "", $mytable);
    
    $mytable = $mytable."a_table.jpg";
    echo "<img width='100%' src='".$mytable."'>"; 
    
    echo "</td></tr></table></center>";
   echo "<center>  <br><b>NB: ALWAYS BRING THIS CARD TO EXAMINATION HALL </b></center>";
     ECHO "<center><br> <b> ITEMS ALLOWED: FACE MASK, PENCIL, ERASER, RULER, PEN, ANNUAL & PRESENT VALUE TABLE AND UNMARKED BESMM4R FOR MEASUREMENT ONLY </b> ";
	   ECHO "	<br><br> <b> LATENESS TO THE EXAMINATION HALL WILL NOT BE ENTERTAINED. </b> </center>";
	   //if($centre=="ABUJA"){ echo "<br><center> Accommodation available within the vicinity at affordable rate. </center>"; }
	   if($centre=="ENUGU"){ echo "<br><center><font color='red'> <b> DUE TO THE CURRENT SECURITY CHALLENGES, CANDIDATES ARE ADVISED TO GET ACCOMMODATION CLOSE TO THE VENUE NOT LATER THAN 24HRS BEFORE THE EXAMINATION. </b></font></center>"; }

   echo "<br><br>";
   
 }

}else{ echo mysqli_error($con); }


?>

</body>
</html>