<?php
try
{
   $pdo = new PDO('mysql:host=localhost; dbname=dbvalidationinscription', 'root','');
   //echo 'Connection Successfull';
}
catch(PDOException $error)
{
   echo $error->getmessage();
}
session_start();
if(isset($_POST['btn_login']))
{
	
   	$dpe = $_POST['dpeID'];
    $dce= $_POST['dce'];
    $username = $_POST['edition'];
    $password = $_POST['numinscription'];
    $select = $pdo->prepare("select * from tbl_excel where dpeID='$dpe' AND dce='$dce' and edition='$username' AND numinscription='$password'");
    $select->execute();
    $row = $select->fetch(PDO::FETCH_ASSOC);

     
	 
    if($row['edition']==$username AND $row['numinscription']==$password AND $row['dpeID']==$dpe AND $row['dce']==$dce)
    {
     
	     $_SESSION['section']=$row['section'];
        $_SESSION['dpeID']=$row['dpeID'];
        $_SESSION['dce']=$row['dce'];
        $_SESSION['username']=$row['edition'];
        $_SESSION['password']=$row['numinscription'];
  
       
        
        
       echo "<script type='text/javascript'>alert('Connection Successfull');</script>";
			  echo "<script>document.location='register/'</script>";  
    }
   else
		{	

			echo "<script type='text/javascript'>alert('Connection failed!!! email or password incorrect.Try aigan');</script>";
		echo "<script>document.location='index.php'</script>";  
		}
   
   
   
   
    
}
?>


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

	<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<?php include('headers.php'); ?>

<body>
<style>
.header__top{
	background:#2a8fc7;
}

.foot{
	background:#2a8fc7;
}
</style>
  <!-- Back to top button -->
  <div class="back-to-top"></div>

  <header>
      <!-- Top Section start -->
      <div class="header__top">
           <!-- ======= Top Bar start ======= -->
  <font size='4'> <center><marquee scrollamount='2' > <font  color='white'>Recours en ligne</font></marquee> </center></font>
<!-- ======= Top Bar end ======= -->
    </div>

    <!-- Top Section End -->


    <!-- Navbar start -->
            <!-- Navbar start -->
        <nav style="z-index: 2" class="navbar navbar-expand-lg navbar-light  sticky" data-offset="0">
            <div class="container">
               <a href="#" class="navbar-brand"><img alt="Université du Burundi Logo" width='250' src='logoBanderolleUBP.PNG'></a>

                <button class="navbar-toggler" data-toggle="collapse" data-target="#navbarContent" aria-controls="navbarContent" aria-expanded="false" aria-label="Toggle navigation">
                    <span class="navbar-toggler-icon"></span>
                </button>

                <div class="navbar-collapse collapse" id="navbarContent">

                    <h5 class="section-subtitle"> Formulaire des recours  </h5>
                </div>

            </div>
        </nav>
        <!-- Navbar end -->
    <!-- Navbar end -->

</header> <!-- Header end-->
 
<!-- Evisa tab-->

<section style="background-image: url(skulls.png); background-repeat: none; background-size: cover" class="py-5 header bg-white">
   
   <div class="container py-4">
        
      <div style="margin-bottom: 240px" class="row">
        <div class="col-md-3">
	
            <!-- Tabs nav -->
            <div class="nav flex-column nav-pills nav-pills-custom" id="v-pills-tab" role="tablist" aria-orientation="vertical">
    <a class="nav-link mb-3 p-3 shadow active " id="v-pills-infos-tab"  href="#" role="tab" aria-controls="v-pills-home" aria-selected="fasle" disabled>
        <i class="fa fa-user-circle-o mr-2"></i>
        <span class="font-weight-bold small text-uppercase">Informations personnelles</span>
        </a>

    <a class="nav-link mb-3 p-3 shadow" href="#" data-toggle="modal" data-target="#modal_4" >
        <i class="fa fa-info-circle mr-2"></i>
        <span class="font-weight-bold small text-uppercase">Veuillez d'abord verifier votres information personnelle en completant le formilaire conformement aux données du minisrère</span>
    </a>

    <a class="nav-link mb-3 p-3 shadow " id="v-pills-confirmation-tab" href="guide/" role="tab" aria-controls="v-pills-confirmation" aria-selected="false" disabled>
        <i class="fa fa-check mr-2"></i>
        <span class="font-weight-bold small">
		<font color='blue'>Veuillez d'abord lire le guide avant de proceder à l'inscription</font>
		
		
		
		
		</span>
    </a>

  </div>        </div>


        <div class="col-md-9">
            <!-- Tabs content -->
				 <h6> Etape 1:Verfication des informations personnelles  </h5>
            <div class="tab-content" id="v-pills-tabContent">

                <div class="tab-pane fade shadow rounded bg-white show active" id="v-pills-infos" role="tabpanel" aria-labelledby="v-pills-infos-tab">
                   
                    <h4 style="font-size: 20px" class="section-subtitle-dark">Verfication des informations personnelles içi</h4>



                

<?php
include('dbcon.php');
include('db_config.php');
?>
             
                    <div class="card-body">




                       <div class="basic-form">
                         <form action=" " enctype="multipart/form-data" method="post" accept-charset="utf-8">
<input type="hidden" name="categorie_visa" value="4" />
                         <div class="form-row">
                          <input type="hidden" id="id" name="id" value="">
                          <input type="hidden" name="test_age" id="test_age">
                          <input type="hidden" value="fr" name="lang" id="lang">
                          <input type="hidden" id="categorie_visa" value="4">
                          <input type="hidden" id="fuseau" name="fuseau" value="2">
                  <div class="form-group col-md-6" id="div_adresse_complet">
            <label>Votre DPE <span style="color: red;">*</span></label>
           <select  name='dpeID' class="form-control" id="dpe">
					<option value="">Selectionner votre DPE</option>
					<?php 
					$query = "SELECT * FROM tbl_dpe order by dpenom asc";
					$result = $con->query($query);
					if ($result->num_rows > 0) {
						while ($row = $result->fetch_assoc()) {
							echo '<option value="'.$row['dpeID'].'">'.$row['dpenom'].'</option>';
						}
					}else{
						echo '<option value="">DPE not available</option>'; 
					}
					?>
				</select>
            <span class="help-block" id="err_adresse_complet"></span>
            <i></i>

        </div>

		
		<div class="form-group col-md-6" id="div_adresse_complet">
            <label>Votre DCE <span style="color: red;">*</span></label>
           <select name='dce' class="form-control" id="dce">
					<option value="">Selectionner le DCE</option>
				</select>
            <span class="help-block" id="err_adresse_complet"></span>
            <i></i>

        </div>
		
		
		<div class="form-group col-md-6" id="div_adresse_complet">
            <label>Edition<span style="color: red;">*</span></label>
            <select type="text" placeholder="Tapez votre notes obtenu à l'examen d'Etat"  name="edition" class="form-control" id="adresse_complet" value="" required = "required">
                 <option value=''>Selection votre edition</option> 
			<option value='2023'>2023</option> 
			 <option value='2022'>2022</option> 
			  
			  
			  </select>
            <span class="help-block" id="err_adresse_complet"></span>
            <i></i>

        </div>


<div class="form-group col-md-6" id="div_adresse_complet">
            <label>Numéro d'inscription <span style="color: red;">*</span></label>
            <input type="text" placeholder="Tapez votre numero d'inscription"  name="numinscription" class="form-control" id="adresse_complet" value="" required = "required">

            <span class="help-block" id="err_adresse_complet"></span>
            <i></i>

        </div>

   <a href='Admin/login.php'>Login </a>
<br>
<div class="form-group col-md-12 text-center">
  <div class="col-xs-12 col-md-6"><input type="submit" name="btn_login" value="Vérifier" class="btn btn-info" tabindex="7">    <input type="reset" name="save" value="Annuler" class="btn btn-info" tabindex="7"></div>

  
  <script src="js/jquery-3.2.1.min.js"></script>
<script src="js/bootstrap.js"></script>
<script src="js/script.js"></script>


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



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

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

    <footer class="foot">
       <?php
include('footer.php');
?>
    </footer>
    <!-- footer end -->


 <script type="text/javascript">
    $(document).ready(function(){
      // dpe dependent ajax
      $("#dpe").on("change",function(){
        var dpeId = $(this).val();
        $.ajax({
          url :"action.php",
          type:"POST",
          cache:false,
          data:{dpeId:dpeId},
          success:function(data){
            $("#dce").html(data);
            $('#city').html('<option value="">Select city</option>');
          }
        });			
      });

      // dce dependent ajax
      $("#dce").on("change", function(){
        var dceId = $(this).val();
        $.ajax({
          url :"action.php",
          type:"POST",
          cache:false,
          data:{dceId:dceId},
          success:function(data){
            $("#city").html(data);
          }
        });
      });
    });
  </script>
</body>

<link rel="stylesheet" href="//code.jquery.com/ui/1.13.0/themes/base/jquery-ui.css">
<!-- <link rel="stylesheet" href="/resources/demos/style.css"> -->
<script src="https://code.jquery.com/ui/1.13.0/jquery-ui.js"></script>
<script src="https://migration.gov.bi/assets/js/floating-wpp.js"></script>

 
</html>