<?php //require_once('session.php'); ?>

<?php require_once('db.php'); ?>

<?php
if(isset($_POST["submit"]) && $_POST["submit"]!="") {
   // Check if a file was uploaded
    
$target_dir = "passport/";
$filenames="";
$target_file = $target_dir . basename($_FILES["fileUpload1"]["name"]);

$uploadOk = 1;
$imageFileType = strtolower(pathinfo($target_file,PATHINFO_EXTENSION));


if( isset($_FILES['fileUpload1']['name'])) {
    $check = getimagesize($_FILES["fileUpload1"]["tmp_name"]);
    if($check !== false) {
        //echo "File is an image - " . $check["mime"] . ".";
        $uploadOk = 1;
    } else {
        //echo "File is not an image.";
        $uploadOk = 0;
    }
    
    // Check file size
if ($_FILES["fileUpload1"]["size"] > 100000) {
    echo "Sorry, your file is too large.";
    $uploadOk = 0;
}
    

if ($uploadOk == 0) {
    echo "Sorry, your file was not uploaded.";
// if everything is ok, try to upload file
} else {
   
    // Check if file is selected
    if(isset($_FILES['fileUpload1']['name']) && $_FILES['fileUpload1']['size'] > 0) {
      
      $original_filename1 = $_FILES['fileUpload1']['name']; 
          
      // Get the fileextension
      $ext1 = pathinfo($original_filename1, PATHINFO_EXTENSION);  
       
      // Get filename without extesion
      $filename_without_ext1 = basename($original_filename1, '.'.$ext1);

      // Generate new filename
      $new_filename1 = str_replace(' ', '_', $filename_without_ext1) . '_' . time() . '.' . $ext1; 
      

      // Upload the file with new name
      $filenames1= $new_filename1;

      move_uploaded_file($_FILES['fileUpload1']['tmp_name'], $target_dir . $new_filename1);    
      
   $image1 = $filenames1;
    }  
  }
}

    $surname = $_POST['surname'];
    $othername = $_POST['othername'];
    $firstname = $_POST['firstname'];
    $address = $_POST['address'];
    $state = $_POST['state'];
    $phone = $_POST['phone'];
    $nationality = $_POST['nationality'];
    $dob = $_POST['dob'];
    $sex = $_POST['sex'];
    $class = $_POST['C1'];
    $previous_school = $_POST['previous_school'];
    $class_seeking = $_POST['class_seeking'];
    $place_birth = $_POST['place_birth'];
    $religion = $_POST['religion'];
    $father_name = $_POST['father_name'];
    $office = $_POST['office'];
    $phone = $_POST['phone'];
    $email = $_POST['email'];
    $mother_name = $_POST['mother_name'];
    $office2 = $_POST['office2'];
    $phone2 = $_POST['phone2'];
    $email2 = $_POST['email2'];
    $rank = $_POST['rank'];
    $rank2 = $_POST['rank2'];

    $total = $_POST['total'];
    $paid = $_POST['paid'];
    $balance = $_POST['balance'];
    $duration = $_POST['duration'];
    $date = date('Y-m-d');
    $end = date('Y-m-d', strtotime($date. ' + '. $duration. ' months'));
    $date2 = date('M');
    $end2 = date('M', strtotime($date2. ' + '. $duration. ' months'));
    $period = $date2." - ".$end2;




    $class = "";
    $ss1 = "";
    $ss2 = "";
    $ss3 = "";
    $ss4 = "";
    $ss5 = "";
    $ss6 = "";
    $ss7 = "";
    $ss8 = "";
    $ss9 = "";
    $ss10 = "";
    $ss11 = "";
    $ss12 = "";
    $ss13 = "";
    $ss14 = "";
    $ss15 = "";
    $ss16 = "";
    $ss17 = "";
    $ss18 = "";
    $ss19 = "";
    $ss20 = "";
  

       
  $balance = $total - $paid;



      $biodata = "INSERT INTO student_info(surname, firstname, othername, phone, regno, course, address,  state, nationality, dob,  balance, period, place_birth, sex, previous_school, class_seeking, father_name, office, phone, email, rank, mother_name, office2, phone2, email2, rank2) 
                         VALUES ('$surname', '$firstname', '$othername','$phone', '$regno', '$course', '$address', '$state', '$nationality', '$dob',  '$balance', '$period', '$place_birth', '$sex', '$previous_school', '$class_seeking', '$father_name', '$office', '$phone', '$email', '$rank', '$mother_name', '$office2', '$phone2', '$email2', '$rank2')";
      
      $sendbiodata = mysqli_query($conn, $biodata);
      

  if ($sendbiodata){
        $final = "INSERT INTO register(surname, firstname, othername, regno, telephone, address, city, state, nationality, course,  total, paid, balance) 
                         VALUES ('$surname', '$firstname', '$othername', '$regno', '$phone', '$address', '$city', '$state', '$nationality',      '$course', '$total', '$paid', '$balance')";
      $final_reg = mysqli_query($conn, $final);
  }
    if($final_reg){
      $ca1 = "INSERT INTO ca1(name, regno, course, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15, s16, s17, s18, s19, s20) 
                         VALUES ('$name', '$regno','$course', '$ss1', '$ss2', '$ss3', '$ss4', '$ss5', '$ss6', '$ss7', '$ss8', '$ss9', '$ss10', '$ss11', '$ss12', '$ss13', '$ss14', '$ss15', '$ss16', '$ss17', '$ss18', '$ss19', '$ss20')";
      
      $enterca1 = mysqli_query($conn, $ca1);
    }
        if($enterca1){
      $ca2 = "INSERT INTO ca2(name, regno, course, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15, s16, s17, s18, s19, s20) 
                         VALUES ('$name', '$regno','$course', '$ss1', '$ss2', '$ss3', '$ss4', '$ss5', '$ss6', '$ss7', '$ss8', '$ss9', '$ss10', '$ss11', '$ss12', '$ss13', '$ss14', '$ss15', '$ss16', '$ss17', '$ss18', '$ss19', '$ss20')";
      
      $enterca2 = mysqli_query($conn, $ca2);
    }
    
    if($enterca2){
      $ca3 = "INSERT INTO resume_test(name, regno, course, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15, s16, s17, s18, s19, s20) 
                         VALUES ('$name', '$regno','$course', '$ss1', '$ss2', '$ss3', '$ss4', '$ss5', '$ss6', '$ss7', '$ss8', '$ss9', '$ss10', '$ss11', '$ss12', '$ss13', '$ss14', '$ss15', '$ss16', '$ss17', '$ss18', '$ss19', '$ss20')";
      
      $enterca3 = mysqli_query($conn, $ca3);
    }

     if($enterca3){
    $exams = "INSERT INTO exam(name, regno, course, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15, s16, s17, s18, s19, s20) 
                         VALUES ('$name', '$regno','$course', '$ss1', '$ss2', '$ss3', '$ss4', '$ss5', '$ss6', '$ss7', '$ss8', '$ss9', '$ss10', '$ss11', '$ss12', '$ss13', '$ss14', '$ss15', '$ss16', '$ss17', '$ss18', '$ss19', '$ss20')";
      
      $enterexam = mysqli_query($conn, $exams);
    }

         if($enterexam){
    $exams2 = "INSERT INTO overall(name, regno, course, pin, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, s13, s14, s15, s16, s16, s17, s18, s19, s20, t1, t2, t3, t4, t5, t6, t7, t8, t9, t10, t11, t12, t13, t14, t15, t16,  t17, t18, t19, t20, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20, y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13, y14, y15, y16, y17, y18, y19, y20, c1, c2, c3, c4, c5, c6, c7, c8, c9, c10, c11, c12, c13, catotal) 
                         VALUES ('$name', '$regno','$course', '', '$ss1', '$ss2', '$ss3', '$ss4', '$ss5', '$ss6', '$ss7', '$ss8', '$ss9', '$ss10', '$ss11', '$ss12', '$ss13', '$ss14', '$ss15', '$ss16', '$ss17', '$ss18', '$ss19', '$ss20',
                                                                  '$ss1', '$ss2', '$ss3', '$ss4', '$ss5', '$ss6', '$ss7', '$ss8', '$ss9', '$ss10', '$ss11', '$ss12', '$ss13', '$ss14', '$ss15', '$ss16', '$ss17', '$ss18', '$ss19', '$ss20',
                                                                  '$ss1', '$ss2', '$ss3', '$ss4', '$ss5', '$ss6', '$ss7', '$ss8', '$ss9', '$ss10', '$ss11', '$ss12', '$ss13', '$ss14', '$ss15', '$ss16', '$ss17', '$ss18', '$ss19', '$ss20',
                                                                  '$ss1', '$ss2', '$ss3', '$ss4', '$ss5', '$ss6', '$ss7', '$ss8', '$ss9', '$ss10', '$ss11', '$ss12', '$ss13', '$ss14', '$ss15', '$ss16', '$ss17', '$ss18', '$ss19', '$ss20',
                                                                  '$ss1', '$ss2', '$ss3', '$ss4', '$ss5', '$ss6', '$ss7', '$ss8', '$ss9', '$ss10', '$ss11', '$ss12', '$ss13', '0'  )";
      
      $enteroverall= mysqli_query($conn, $exams2);
    }

    if($enteroverall){
      $payment1 = "INSERT INTO payment(name, regno, course, fee,  paid, balance, receipt_no, mode) 
                         VALUES ('$name', '$regno', '$course', '$total', '$paid', '$balance', '', '')";
      
      $enterpayment = mysqli_query($conn, $payment1);
    }  
    if($enterpayment){
      $s = 1;
      mysqli_query($conn, "UPDATE count_reg SET numbers = '$new_id' WHERE course = '$class'");
    }
  else{
          $message = 'Student registration fail!';
      }


   
}
      ?>

<!DOCTYPE html>
<html lang="en">

<head>
    <title>Register </title>
    <!-- HTML5 Shim and Respond.js IE10 support of HTML5 elements and media queries -->
    <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
    <!--[if lt IE 10]>
    <script src="https://oss.maxcdn.com/libs/html5shiv/3.7.0/html5shiv.js"></script>
    <script src="https://oss.maxcdn.com/libs/respond.js/1.4.2/respond.min.js"></script>
    <![endif]-->
    <!-- Meta -->
       <meta charset="utf-8">
      <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimal-ui">
      <meta http-equiv="X-UA-Compatible" content="IE=edge" />
      <meta name="description" content="I-BOS School Management System is a web-based application that built into a 3 module namely: Admin Module, Exam Module and Result Module" />
      <meta name="keywords" content="school management system, student registration, payment processing, online exams, test entry, result generation, and result checking" />
      <meta name="author" content="Ideboghie Benedict I-BOS" />
      <!-- Favicon icon -->
    <link rel="icon" href="assets/images/favicon.ico" type="image/x-icon">
    <!-- Google font-->
    <link href="https://fonts.googleapis.com/css?family=Roboto:400,500" rel="stylesheet">
    <!-- waves.css -->
    <link rel="stylesheet" href="assets/pages/waves/css/waves.min.css" type="text/css" media="all">
    <!-- Required Fremwork -->
    <link rel="stylesheet" type="text/css" href="assets/css/bootstrap/css/bootstrap.min.css">
    <!-- waves.css -->
    <link rel="stylesheet" href="assets/pages/waves/css/waves.min.css" type="text/css" media="all">
    <!-- themify-icons line icon -->
    <link rel="stylesheet" type="text/css" href="assets/icon/themify-icons/themify-icons.css">
    <!-- ico font -->
    <link rel="stylesheet" type="text/css" href="assets/icon/icofont/css/icofont.css">
    <!-- Font Awesome -->
    <link rel="stylesheet" type="text/css" href="assets/icon/font-awesome/css/font-awesome.min.css">
    <!-- Style.css -->
    <link rel="stylesheet" type="text/css" href="assets/css/style.css">
    <link rel="stylesheet" type="text/css" href="assets/css/jquery.mCustomScrollbar.css">
    
        <style>
body {
      background-color: #d7d6d3;
      font-family:'verdana';
    }
    .id-card-holder {
      width: 225px;
        padding: 4px;
        margin: 0 auto;
        background-color: #1f1f1f;
        border-radius: 5px;
        position: relative;
    }
    .id-card-holder:after {
        content: '';
        width: 7px;
        display: block;
        background-color: #0a0a0a;
        height: 100px;
        position: absolute;
        top: 105px;
        border-radius: 0 5px 5px 0;
    }
    .id-card-holder:before {
        content: '';
        width: 7px;
        display: block;
        background-color: #0a0a0a;
        height: 100px;
        position: absolute;
        top: 105px;
        left: 222px;
        border-radius: 5px 0 0 5px;
    }
    .id-card {
      
      background-color: #fff;
      padding: 10px;
      border-radius: 10px;
      text-align: center;
      box-shadow: 0 0 1.5px 0px #b9b9b9;
      background-repeat: no-repeat;
      background-position: center; 
    }
    .id-card img {
      margin: 0 auto;

    }
    .header img {
        margin-top: 15px;
    }
    .photo img {
      width: 80px;
        margin-top: 15px;
    }
    h2 {
      font-size: 15px;
      margin: 5px 0;
    }
    h3 {
      font-size: 12px;
      margin: 2.5px 0;
      font-weight: 300;
    }
    .qr-code img {
      width: 50px;
    }
    p {
      font-size: 5px;
      margin: 2px;
    }
    .id-card-hook {
      background-color: #000;
        width: 70px;
        margin: 0 auto;
        height: 15px;
        border-radius: 5px 5px 0 0;
    }
    .id-card-hook:after {
      content: '';
        background-color: #d7d6d3;
        width: 47px;
        height: 6px;
        display: block;
        margin: 0px auto;
        position: relative;
        top: 6px;
        border-radius: 4px;
    }
    .id-card-tag-strip {
      width: 45px;
        height: 40px;
        background-color: #0950ef;
        margin: 0 auto;
        border-radius: 5px;
        position: relative;
        top: 9px;
        z-index: 1;
        border: 1px solid #0041ad;
    }
    .id-card-tag-strip:after {
      content: '';
        display: block;
        width: 100%;
        height: 1px;
        background-color: #c1c1c1;
        position: relative;
        top: 10px;
    }
    .id-card-tag {
      width: 0;
      height: 0;
      border-left: 100px solid transparent;
      border-right: 100px solid transparent;
      border-top: 100px solid #0958db;
      margin: -10px auto -30px auto;
    }
    .id-card-tag:after {
      content: '';
        display: block;
        width: 0;
        height: 0;
        border-left: 50px solid transparent;
        border-right: 50px solid transparent;
        border-top: 100px solid #d7d6d3;
        margin: -10px auto -30px auto;
        position: relative;
        top: -130px;
        left: -50px;
    }
    </style>

    <style>
    
    /* Full-width input fields */
    input[type=text], input[type=password], input[type=number], select {
        width: 100%;
        padding: 12px 20px;
        margin: 8px 0;
        display: inline-block;
        border: 1px solid #ccc;
        box-sizing: border-box;
    }
    
    /* Set a style for all buttons */
    button {
        background-color: #4CAF50;
        color: white;
        padding: 14px 20px;
        margin: 8px 0;
        border: none;
        cursor: pointer;
        width: 70%;
    }
    
    button:hover {
        opacity: 0.8;
    }
    
    /* Extra styles for the cancel button */
    .cancelbtn {
        width: auto;
        padding: 14px 20px;
        background-color: #f44336;
    }
    
    /* Center the image and position the close button */
    .imgcontainer {
        text-align: center;
        margin: 24px 0 12px 0;
        position: relative;
    }
    
    img.avatar {
        width: 40%;
        border-radius: 50%;
    }
    
    .container {
        padding: 16px;
        height: 330px;
    }
    
    span.psw {
        float: right;
        padding-top: 16px;
    }
    
    /* The Modal (background) */
    .modal {
        display: none; /* Hidden by default */
        position: fixed; /* Stay in place */
        z-index: 1; /* Sit on top */
        left: 0;
        top: 0;
        width: 100%; /* Full width */
        height: 100%; /* Full height */
        overflow: auto; /* Enable scroll if needed */
        background-color: rgb(0,0,0); /* Fallback color */
        background-color: rgba(0,0,0,0.4); /* Black w/ opacity */
        padding-top: 60px;
        height: 350px;
    }
    
    /* Modal Content/Box */
    .modal-content {
        background-color: #fefefe;
        margin: 5% auto 5% auto; /* 5% from the top, 15% from the bottom and centered */
        border: 1px solid #888;
        width: 1000px; /* Could be more or less, depending on screen size */

    }
    
    /* The Close Button (x) */
    .close {
        position: absolute;
        right: 25px;
        top: 0;
        color: #000;
        font-size: 35px;
        font-weight: bold;
    }
    
    .close:hover,
    .close:focus {
        color: red;
        cursor: pointer;
    }
    
    /* Add Zoom Animation */
    .animate {
        -webkit-animation: animatezoom 0.6s;
        animation: animatezoom 0.6s
    }
    
    @-webkit-keyframes animatezoom {
        from {-webkit-transform: scale(0)} 
        to {-webkit-transform: scale(1)}
    }
        
    @keyframes animatezoom {
        from {transform: scale(0)} 
        to {transform: scale(1)}
    }
    
    /* Change styles for span and cancel button on extra small screens */
    @media screen and (max-width: 300px) {
        span.psw {
           display: block;
           float: none;
        }
        .cancelbtn {
           width: 100%;
        }
    
    }



/* Bottom right text */
.text-block {
  position: absolute;
  top: 15%;
  left: 15%;
  width: 70%;
  height: 350px;
} 
.box{
  border: 2px;
  border-color: black;
  border-style: solid;
}
    </style>

</head>

<body>
 <?php include('navigation.php');?>   
                    <div class="pcoded-content">
                        <!-- Page-header start -->
                        <div class="page-header">
                            <div class="page-block">
                                <div class="row align-items-center">
                                    <div class="col-md-8">
                                        <div class="page-header-title">
                                            <h5 class="m-b-10">Student Registration Form</h5>
                                            <p class="m-b-0">Fill out the form below and submit to register a student.</p>
                                        </div>
                                    </div>
                                    <div class="col-md-4">
                                        <ul class="breadcrumb-title">
                                            <li class="breadcrumb-item">
                                                <a href="index.php"> <i class="fa fa-home"></i> </a>
                                            </li>
                                            <li class="breadcrumb-item"><a href="#!"></a>
                                            </li>
                                            <li class="breadcrumb-item"><a href="#!"></a>
                                            </li>
                                        </ul>
                                    </div>
                                </div>
                            </div>
                        </div>
                        <!-- Page-header end -->
                        <div class="pcoded-inner-content">
                            <!-- Main-body start -->
                            <div class="main-body">
                                <div class="page-wrapper">
                                  
                                    <!-- Page body start -->
                                    
                                        <div class="row">
                                            <div class="col-md-12">
                                                <div class="card">
                                                    <div class="card-header">
                                                        <h3>Student Registration Form</h3>
                                                    </div>
                                                    <div class="card-block">
                                                       <div class="id-card-holder" >
    <div class="id-card" style="background-image: url(assets/images/nicowa_fade3.jpg);">
      <div class="header">
        <img src="assets/images/logo_3.png" width="50px" height="45px"><b><font color="#005600"><h3>NICOWA SCHOOL</h3></font></b>  
        <p>Suite 25, Awmar Plaza, Cele Bus-Stop, Jikwoyi, Abuja (FCT)<p>
      <p>Phone: 0810 000 0000 | E-mail: nicowaschool@gmail.com</p>

      </div>
      <div class="photo">
        <img src="assets/images/user.jpg">
      </div>
      <h2><?php echo strtoupper($name);?></h2>
      
      <h3><?php echo $course;?></h3>

      <h3><?php echo $regno;?></h3>
      <hr>
      
   
    </div>
  </div>
        </div>
    </div>
          <button  type="button" onclick="window.print()" class="btn btn-primary btn-sm" id="myBtn" style="width:auto;">Print ID Card <span class="glyphicon glyphicon-print" aria-hidden="true"></span></button>
      </form>
    </div>
  
                                                        
                                                        
                                                        
                                                    </div>
                                                </div>
                                            </div>
                                            
                                        </div>
                                                            <!-- Page body end -->
                                    </div>
                                </div>
                                                    <!-- Main-body end -->
                            <div id="styleSelector">

                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>


                            <!-- Warning Section Starts -->
                            <!-- Older IE warning message -->
<!--[if lt IE 10]>
<div class="ie-warning">
    <h1>Warning!!</h1>
    <p>You are using an outdated version of Internet Explorer, please upgrade <br/>to any of the following web browsers
        to access this website.</p>
    <div class="iew-container">
        <ul class="iew-download">
            <li>
                <a href="http://www.google.com/chrome/">
                    <img src="assets/images/browser/chrome.png" alt="Chrome">
                    <div>Chrome</div>
                </a>
            </li>
            <li>
                <a href="https://www.mozilla.org/en-US/firefox/new/">
                    <img src="assets/images/browser/firefox.png" alt="Firefox">
                    <div>Firefox</div>
                </a>
            </li>
            <li>
                <a href="http://www.opera.com">
                    <img src="assets/images/browser/opera.png" alt="Opera">
                    <div>Opera</div>
                </a>
            </li>
            <li>
                <a href="https://www.apple.com/safari/">
                    <img src="assets/images/browser/safari.png" alt="Safari">
                    <div>Safari</div>
                </a>
            </li>
            <li>
                <a href="http://windows.microsoft.com/en-us/internet-explorer/download-ie">
                    <img src="assets/images/browser/ie.png" alt="">
                    <div>IE (9 & above)</div>
                </a>
            </li>
        </ul>
    </div>
    <p>Sorry for the inconvenience!</p>
</div>
<![endif]-->
<!-- Warning Section Ends -->
<!-- Required Jquery -->
<script type="text/javascript" src="assets/js/jquery/jquery.min.js"></script>
<script type="text/javascript" src="assets/js/jquery-ui/jquery-ui.min.js "></script>
<script type="text/javascript" src="assets/js/popper.js/popper.min.js"></script>
<script type="text/javascript" src="assets/js/bootstrap/js/bootstrap.min.js "></script>
<!-- jquery slimscroll js -->
<script type="text/javascript" src="assets/js/jquery-slimscroll/jquery.slimscroll.js "></script>
<!-- waves js -->
<script src="assets/pages/waves/js/waves.min.js"></script>

<!-- modernizr js -->
<script type="text/javascript" src="assets/js/SmoothScroll.js"></script>
<script src="assets/js/jquery.mCustomScrollbar.concat.min.js "></script>
<!-- Custom js -->
<script src="assets/js/pcoded.min.js"></script>
<script src="assets/js/vertical-layout.min.js "></script>
<script src="assets/js/jquery.mCustomScrollbar.concat.min.js"></script>
<script type="text/javascript" src="assets/js/script.js"></script>
</body>

</html>
