<?php
session_start();
$_SESSION['idno'] = $_POST['idno'];
$_SESSION['semester'] = $_POST['semester'];
$_SESSION['session'] = $_POST['session'];
$_SESSION['pinno'] = $_POST['pinno'];
$_SESSION['serial'] = $_POST['serial'];
$_SESSION['login_nos'] = $_POST['login_nos'];
?>
<?php require_once('Connections/mycon.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "") 
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;    
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

// *** Redirect if username exists
$MM_flag="MM_insert";
if (isset($_POST[$MM_flag])) {
  $MM_dupKeyRedirect="usedcardPri.php";
  $loginUsername = $_POST['pinno'];
  $LoginRS__query = sprintf("SELECT pinno FROM checkers WHERE pinno=%s", GetSQLValueString($loginUsername, "text"));
  mysql_select_db($database_mycon, $mycon);
  $LoginRS=mysql_query($LoginRS__query, $mycon) or die(mysql_error());
  $loginFoundUser = mysql_num_rows($LoginRS);

  //if there is a row in the database, the username was found - can not add the requested username
  if($loginFoundUser){
    $MM_qsChar = "?";
    //append the username to the redirect page
    if (substr_count($MM_dupKeyRedirect,"?") >=1) $MM_qsChar = "&";
    $MM_dupKeyRedirect = $MM_dupKeyRedirect . $MM_qsChar ."requsername=".$loginUsername;
    header ("Location: $MM_dupKeyRedirect");
    exit;
  }
}

$editFormAction = $_SERVER['PHP_SELF'];
if (isset($_SERVER['QUERY_STRING'])) {
  $editFormAction .= "?" . htmlentities($_SERVER['QUERY_STRING']);
}

if ((isset($_POST["MM_insert"])) && ($_POST["MM_insert"] == "form1")) {
  $insertSQL = sprintf("INSERT INTO checkers (idno, pinno, `date`) VALUES (%s, %s, %s)",
                       GetSQLValueString($_POST['idno'], "text"),
                       GetSQLValueString($_POST['pinno'], "text"),
                       GetSQLValueString($_POST['date'], "date"));

  mysql_select_db($database_mycon, $mycon);
  $Result1 = mysql_query($insertSQL, $mycon) or die(mysql_error());

  $insertGoTo = "showresulttPri.php";
  if (isset($_SERVER['QUERY_STRING'])) {
    $insertGoTo .= (strpos($insertGoTo, '?')) ? "&" : "?";
    $insertGoTo .= $_SERVER['QUERY_STRING'];
  }
  header(sprintf("Location: %s", $insertGoTo));
}

mysql_select_db($database_mycon, $mycon);
$query_Recordset1 = "SELECT * FROM card";
$Recordset1 = mysql_query($query_Recordset1, $mycon) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);
?>
<?php
// *** Validate request to login to this site.
if (!isset($_SESSION)) {
  session_start();
}

$loginFormAction = $_SERVER['PHP_SELF'];
if (isset($_GET['accesscheck'])) {
  $_SESSION['PrevUrl'] = $_GET['accesscheck'];
}

if (isset($_POST['pinno'])) {
  $loginUsername=$_POST['pinno'];
  $password=$_POST['serial'];
  $MM_fldUserAuthorization = "";
  $MM_redirectLoginSuccess = "showresulttPri.php";
  $MM_redirectLoginFailed = "invalidcard.php";
  $MM_redirecttoReferrer = false;
  mysql_select_db($database_mycon, $mycon);
  
  $LoginRS__query=sprintf("SELECT pinno, serial, login_nos, sno FROM card WHERE pinno=%s AND serial=%s",
    GetSQLValueString($loginUsername, "text"), GetSQLValueString($password, "text")); 
   
  $LoginRS = mysql_query($LoginRS__query, $mycon) or die(mysql_error());
  $loginFoundUser = mysql_num_rows($LoginRS);
  $row = mysql_fetch_assoc($LoginRS);
$pinno = $row['pinno'];
  if ($loginFoundUser) {
     $loginStrGroup = "";
    
	if (PHP_VERSION >= 5.1) {session_regenerate_id(true);} else {session_regenerate_id();}
    //declare two session variables and assign them
    $_SESSION['MM_Username'] = $loginUsername;
    $_SESSION['MM_UserGroup'] = $loginStrGroup;	      

    if (isset($_SESSION['PrevUrl']) && false) {
      $MM_redirectLoginSuccess = $_SESSION['PrevUrl'];	
    }
	// Insert login count into database

mysql_query('UPDATE card

SET login_nos = login_nos + 1 WHERE pinno = '.$pinno.'')

or die(mysql_error());

    header("Location: " . $MM_redirectLoginSuccess );
  }
  else {
    header("Location: ". $MM_redirectLoginFailed );
  }
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>GILFORD MEMORIAL SCHOOLS: KG3-GRADE 5  Result Checking Point</title>
<link href="http://www.jqueryscript.net/css/jquerysctipttop.css" rel="stylesheet" type="text/css">
<link rel="stylesheet" href="slide/themes/default/default.css" type="text/css" media="screen" />
<link rel="stylesheet" href="slide/themes/light/light.css" type="text/css" media="screen" />
<link rel="stylesheet" href="slide/themes/dark/dark.css" type="text/css" media="screen" />
<link rel="stylesheet" href="slide/themes/bar/bar.css" type="text/css" media="screen" />
<link rel="stylesheet" href="slide/nivo-slider.css" type="text/css" media="screen" />
<link rel="stylesheet" href="slide/demo/style.css" type="text/css" media="screen" />
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<style type="text/css">
#header {
	height: 124px;
	width: 100%;
	margin-bottom: 15px;
}
#INSIDEE {
	height: 80px;
	width: 100%;
	margin-right: auto;
	margin-left: auto;
	background-repeat: no-repeat;
}
#newlogo {
	float: left;
	height: 124px;
	width: 100%;
	text-align: left;
}
#name {
	width: 100px;
	float: left;
}
#menu {
	background-color: #DB5238;
	height: 65px;
	width: 100%;
	margin-right: auto;
	margin-left: auto;
	margin-bottom: 10px;
}
#marq {
	height: auto;
	width: 1000px;
	margin-right: auto;
	margin-left: auto;
	margin-bottom: 8px;
}
#INNNNN {
	height: 60px;
	width: 1000px;
	margin-right: auto;
	margin-left: auto;
}
body {
	background-color: #F0F0F0;
	background-image: url(GilfordMemorialSchoolBackgroundPic.jpg);
}
#wrapper {
	width: 1000px;
	margin-right: auto;
	margin-left: auto;
	height: 380px;
	margin-bottom: 10px;
	color: #000000;
}
#L {
	float: left;
	height: 150px;
	width: 300px;
	border-top-width: 1px;
	border-right-width: 1px;
	border-bottom-width: 1px;
	border-left-width: 1px;
	border-top-style: dotted;
	border-right-style: dotted;
	border-bottom-style: dotted;
	border-left-style: dotted;
}
#M {
	height: 150px;
	width: 290px;
	float: left;
	border-top-width: 1px;
	border-right-width: 1px;
	border-bottom-width: 1px;
	border-left-width: 1px;
	border-top-style: dotted;
	border-right-style: dotted;
	border-bottom-style: dotted;
	border-left-style: dotted;
	text-align: center;
}
#R {
	float: right;
	height: 150px;
	width: 300px;
	text-align: center;
}
#logo {
}
#subfooter {
	width: 1000px;
	margin-right: auto;
	margin-left: auto;
	height: 150px;
	clear: both;
	border-top-width: 10px;
	border-top-style: ridge;
	border-right-width: thin;
	border-bottom-width: thin;
	border-left-width: thin;
	border-right-style: dotted;
	border-bottom-style: dotted;
	border-left-style: dotted;
}
#footer {
	width: 100%;
	margin-right: auto;
	margin-left: auto;
	background-color: #FFFFFF;
	text-align: center;
}
#logo {
	width: 90px;
	margin-left: 200px;
	float: left;
}
#wa {
	-webkit-border-image:url(line2.png) 20 30 35 29 stretch;
	-moz-border-image:url(line2.png) 20 stretch;
	border-image:url(line2.png) 20 stretch;
	float: left;
	width: 60%;
	text-align: left;
	height: auto;
	border-top-width: 10px;
}
#wb {
	float: right;
	width: 390px;
	height: auto;
	border-radius: 20px;
	-webkit-box-shadow: 0 35px 20px #777;
	-moz-box-shadow: 0 35px 20px #777;
	box-shadow: 0 35px 20px #777;
	border: 2px double #000066;
	margin-bottom: 15px;
}
#wrapper #wb table {
	font-size: 12px;
	border-top-color: #006;
	border-right-color: #006;
	border-bottom-color: #006;
	border-left-color: #006;
}
#UP {
	height: 198px;
	width: 390px;
	border-bottom-width: 1px;
	border-bottom-style: dashed;
	border-top-width: 1px;
	border-right-width: 1px;
	border-left-width: 1px;
	border-top-style: dashed;
	border-right-style: dashed;
	border-left-style: dashed;
	text-decoration: none;
}
#dowm {
	height: auto;
	width: 390px;
}
#newname {
	float: left;
	height: 80px;
	width: 370px;
}
#CONTACTT {
	float: right;
	height: 128px;
	width: 400px;
	text-align: center;
}
</style>
<link href='menus/138/menu138id29_style.css' rel='stylesheet' type='text/css' />
<link href='menus/138/menu138id35_style.css' rel='stylesheet' type='text/css' />
<script src="SpryAssets/SpryValidationTextField.js" type="text/javascript"></script>
<script src="SpryAssets/SpryValidationSelect.js" type="text/javascript"></script>
<link href="SpryAssets/SpryValidationTextField.css" rel="stylesheet" type="text/css" />
<link href="SpryAssets/SpryValidationSelect.css" rel="stylesheet" type="text/css" />
<link href='menus/138/menu138id15_style.css' rel='stylesheet' type='text/css' />
<link href='menus/139/menu139id18_style.css' rel='stylesheet' type='text/css' />
<link href='menus/138/menu138id19_style.css' rel='stylesheet' type='text/css' />
<style type="text/css">
<!--
#fotter {
	width: 100%;
	margin-right: auto;
	margin-left: auto;
	text-align: center;
	font-size: 100%;
	font-style: normal;
	height: 100px;
}
.style4 {
	font-weight: bold;
	color: #FFFF00;
	font-size: 20px;
}
.style5 {
	font-size: 16px;
	font-weight: bold;
	color: #000066;
}
.style10 {
	font-size: 36px;
	font-weight: bold;
}
.style11 {color: #FFFFFF}
-->
</style>
</head>

<body background="page.png">
<div id="header"><div id="header">
<div id="INSIDEE">
  <div id="newlogo">
    <div align="center" class="style10">
      <div align="center" class="style10"><img src="GilfordBadgeLogo.png" alt="Victory School Logo" width="118" height="138" align="middle" /> <span class="style11"> GILFORD MEMORIAL SCHOOLS, ABA</span><br />
      </div>
      <br />
    </div>
  </div>
</div>
<div id="wrapper">
  <div id="wa">
    <p align="center"><span style="font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif; font-size: 14px;"><strong><br />
      QUICK STEPS TO CHECK  YOUR RESULT </strong><br />
            <span class="style5"><span style="font-size: 14px">On GILFORD MEMORIAL</span> S<span style="font-size: 14px">CHOOLS' Portal</span></span> <br />
        <span style="font-size: 16px; font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif;"><br />
    </span></span></p>
    <div align="center"><img src="Kidsonlaptop.png" width="551" height="277" alt="Kids On Laptop" />
      <table width="93%" border="0" cellpadding="10" cellspacing="10">
        <tr>
          <td><p><span style="font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif; font-size: 14px;"><span style="font-size: 16px; font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, serif;">To check your result , kindly follow the instructions below <strong>:</strong></span></span></p>
            <ol>
              <li>Carefully scratch off the covered area of your <strong>Scratch Card </strong> <br />
                to reveal your secret <em><strong>PIN</strong></em><br />
                <br />
              </li>
              <li>Enter the following necessary details: <br />
                <em><strong>Admission No, Exam Term, Academic Session, 10-digit PIN (from Scratch Card), and the Card Serial Number.</strong></em><br />
                  <br />
              </li>
              <li>Click on <strong>CHECK RESULT </strong>and wait patiently for your result to display.<br />
                <br />
                <em><strong>For Support</strong>:</em> Pls  call <em><strong>
                Mendoh on +234 803 292 9756. <br />
                email: info@gilfordmemorialschools.com</strong></em><br />
              </li>
            </ol>
          <p></p></td>
        </tr>
      </table>
    <br />
    </div>
  </div>
  <p>&nbsp;</p>
  <div class="checking spot" id="checking">
    <div id="wb">
      <div id="dowm">&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br />
        <table width="100%" border="0" align="center" bgcolor="#0066FF">
          <tr>
              <td align="center" bgcolor="#0066FF"><span class="style11" style="font-family: Tahoma, Geneva, sans-serif; font-weight: bold; font-size: 16px;">ONLINE RESULT CHECKER</span></td>
          </tr>
            <tr>
              <td align="center" bgcolor="#0066FF"><span class="style4"><strong>| KG 3 - Grade 5 | </strong></span></td>
            </tr>
        </table>
        <br />
          <form action="<?php echo $editFormAction; ?><?php echo $loginFormAction; ?>" id="form1" name="form1" method="post">
            <table width="322" border="0" align="center" cellpadding="13" cellspacing="3">
              <tr>
                <td width="124" align="center" style="font-weight: bold"><div align="right">ADMISSION No&nbsp;:</div></td>
                <td width="137" bordercolor="#0066FF"><label for="idno"></label>
                    <span id="sprytextfield1">
                    <input name="idno" type="text" id="idno" size="18" />
                    <br />
                <span class="textfieldRequiredMsg">Admission No   is required.</span><span class="textfieldMinCharsMsg">Invalid Admission No.</span><span class="textfieldMaxCharsMsg">Invalid Admission No.</span></span></td>
              </tr>
              <tr>
                <td align="center" style="font-weight: bold"><div align="right">EXAM TERM&nbsp;:</div></td>
                <td bordercolor="#0066FF"><label for="semester"></label>
                    <span id="spryselect1">
                    <label for="semester"></label>
                    <select name="semester" id="semester">
                      <option>Choose Exam Term</option>
                      <option value="FIRST">FIRST</option>
                      <option value="SECOND">SECOND</option>
                      <option value="THIRD">THIRD</option>
                    </select>
                    <span class="selectRequiredMsg"><br />
                Choose result Term </span></span></td>
              </tr>
              <tr>
                <td align="center" style="font-weight: bold"><div align="right">ACADEMIC SESSION: </div></td>
                <td bordercolor="#0066FF"><label for="session"></label>
                    <select name="session" id="session">
                      <option>Choose Session</option>
                      <option value="2017/2018">2017/2018</option>
                      <option value="2018/2019">2018/2019</option>
                      <option value="2019/2020">2019/2020</option>
                      <option value="2020/2021">2020/2021</option>
                    </select>
                    <span class="selectRequiredMsg"><br />
                Choose result Session.</span></td>
              </tr>
              <tr>
                <td align="center" style="font-weight: bold"><div align="right">CARD PIN:</div></td>
                <td bordercolor="#0066FF"><span id="sprytextfield2">
                  <input name="pinno" type="text" id="pinno" size="18" />
                <span class="textfieldRequiredMsg"><br />
                  Card PIN  is required.</span><span class="textfieldMinCharsMsg"><br />
                      Invalid PIN.</span><span class="textfieldMaxCharsMsg"><br />
                Invalid PIN.</span></span></td>
              </tr>
              <tr>
                <td align="center" style="font-weight: bold"><div align="right">SERIAL NUMBER:</div></td>
                <td bordercolor="#0066FF"><span id="sprytextfield3">
                  <input name="serial" type="text" id="serial" size="18" />
                  <br />
                <span class="textfieldRequiredMsg">Card Serial  is required.</span><span class="textfieldMinCharsMsg">Invalid Card Serial. </span><span class="textfieldMaxCharsMsg">Invalid Card Serial.</span></span></td>
              </tr>
              <tr>
                <td align="center"><input name="date" type="hidden" id="date" />
                    <input name="login_nos" type="hidden" id="login_nos" /></td>
                <td align="center" bordercolor="#660066" bgcolor="#0066FF"><input type="submit" name="button" id="button" target="_blank" value="CHECK RESULT" /></td>
              </tr>
            </table>
            <input type="hidden" name="MM_insert" value="form1" />
          </form>
      </div>
	</div>
    <table width="100%" border="0">
      <tr>
        <td valign="middle"><div id="fotter">
          <p>Copyright © 2017-2018 Gilford Memorial Schools, Aba ::: All Rights Reserved.| <a href="http://dataswiftlimited.com" target="_blank"><img src="datalogo.jpg" alt="DataSwift Limited" width="170" height="80" align="middle" longdesc="https://dataswiftlimited.com" /></a> </p>
        </div></td>
      </tr>
    </table>
  </div>
</div>
<div align="center"></div>
<div align="center">
  <script type="text/javascript">
var sprytextfield1 = new Spry.Widget.ValidationTextField("sprytextfield1", "none", {maxChars:20});
var spryselect1 = new Spry.Widget.ValidationSelect("spryselect1");
var spryselect2 = new Spry.Widget.ValidationSelect("spryselect2");
var sprytextfield2 = new Spry.Widget.ValidationTextField("sprytextfield2", "none", {minChars:10, maxChars:10});
var sprytextfield3 = new Spry.Widget.ValidationTextField("sprytextfield3", "none", {minChars:12, maxChars:12});
  </script>
</div>
</body>
</html>
<?php
mysql_free_result($Recordset1);
?>