<?php
session_start();
if(isset($_SESSION["etudiant_i"]) && isset($_SESSION["idEtablissement"])){
	header("Location:accueil.php");
}
include('notifierErreur2.php');
include_once('Library/Basededonnees.php');

$DB_DATABASEG = 'africawebstudent_universite';
$databaseg = new Basededonnees($DB_DATABASEG);
$bddg = $databaseg->getBdd();

$matricule = '';
$email = '';
$username = '';
$phoneDad = '';
$date_nais = '';
if (isset($_POST['login']) && isset($_POST['datenaiss']) && isset($_POST['motpass1'])) {
    $matricule = $_POST['matri'];
    $email = $_POST['adresse'];
    $username = $_POST['login'];
    $phoneDad = $_POST['phone'];
    $date_nais = $_POST['datenaiss'];
}
$mail = '';
if (isset($_POST['f_mail'])) {
    $mail = $_POST['f_mail'];
}
?>

<!DOCTYPE html>
<html>
    <head>
        <meta charset="utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <meta name="viewport" content="width=device-width, initial-scale=1">
        <meta name="description" content="">
        <meta name="author" content="">
        <link rel="icon" type="image/png" sizes="16x16" href="https://progiciel.geststudent.net/plugins/images/favicon.png">
        <title>GestStudent</title>
        <!-- Bootstrap Core CSS -->
        <link href="bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">
        <!-- animation CSS -->
        <link href="css/animate.css" rel="stylesheet">

        <link rel="shortcut icon" href="img/iitech_nav.ico" />


        <!-- Custom CSS -->
        <link href="css/style.css" rel="stylesheet">
        <link href="css/style-social.css" rel="stylesheet">
        <script src="dist/jquery-1.11.1.min.js"></script>
        <!--alerts CSS -->
        <link href="https://progiciel.geststudent.net/plugins/bower_components/sweetalert/sweetalert.css" rel="stylesheet" type="text/css">
        <!-- page CSS -->
        <link href="https://progiciel.geststudent.net/plugins/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css" rel="stylesheet" type="text/css" />
        <link href="https://progiciel.geststudent.net/plugins/bower_components/custom-select/custom-select.css" rel="stylesheet" type="text/css" />
        <link href="https://progiciel.geststudent.net/plugins/bower_components/switchery/dist/switchery.min.css" rel="stylesheet" />
        <link href="https://progiciel.geststudent.net/plugins/bower_components/bootstrap-select/bootstrap-select.min.css" rel="stylesheet" />
        <link href="https://progiciel.geststudent.net/plugins/bower_components/bootstrap-tagsinput/dist/bootstrap-tagsinput.css" rel="stylesheet" />
        <link href="https://progiciel.geststudent.net/plugins/bower_components/bootstrap-touchspin/dist/jquery.bootstrap-touchspin.min.css" rel="stylesheet" />
        <link href="https://progiciel.geststudent.net/plugins/bower_components/multiselect/css/multi-select.css" rel="stylesheet" type="text/css" />

        <!-- Wizard CSS -->
        <link href="https://progiciel.geststudent.net/plugins/bower_components/jquery-wizard-master/css/wizard.css" rel="stylesheet">

        <!-- Include Select2 CSS -->
        <link rel="stylesheet" href="https://progiciel.geststudent.net/plugins/bower_components/multiselect/css/select2.min.css" />

        <!-- CSS to make Select2 fit in with Bootstrap 3.x -->
        <link rel="stylesheet" href="https://progiciel.geststudent.net/plugins/bower_components/multiselect/css/select2-bootstrap.min.css" />
        <!-- Include Select2 JS -->
        <script src="https://progiciel.geststudent.net/plugins/bower_components/multiselect/css/select2.min.js"></script>

        <!-- color CSS -->
        <link href="css/colors/default.css" id="theme"  rel="stylesheet">
        <!-- HTML5 Shim and Respond.js IE8 support of HTML5 elements and media queries -->
        <!-- WARNING: Respond.js doesn't work if you view the page via file:// -->
        <!--[if lt IE 9]>
            <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]-->

        <style>

            body {
                font-family: "Lucida Sans", Verdana, sans-serif;
                background-size:cover;
                padding-top:0px;
            }

            .white-boxx{background:#fff;padding:25px;margin-bottom:30px;border: 3px solid rgba(253, 153, 200, 0.85);}
            .error-box{background:#fff;padding:5px;margin-bottom:20px;border: 1px solid rgba(255, 0, 0, 0.95);}
            .white-boxx {margin:0 0 12px;font-weight:500;text-transform:uppercase;font-size:12px}

            .main img {
                width: 100%;
            }


            .mainleft img {
                width: 100%;
            }

            h1{
                font-size: 1.625em;
            }

            h2{
                font-size: 1.375em;
            }

            .user-panel{
                background:url(plugins/images/po2.png) center center/cover no-repeat!important;width:500px;height:100%;
            }
            .header {
                padding: 1.0121457489878542510121457489879%;
                background-color: #f1f1f1;
                border: 1px solid #e9e9e9;
            }

            .menuitem {
                margin: 4.310344827586206896551724137931%;
                margin-left: 0;
                margin-top: 0;
                padding: 4.310344827586206896551724137931%;
                cursor: pointer;
            }

            .main {
                padding: 2.0661157024793388429752066115702%;
            }
            .mainleft {
                padding: 2.0661157024793388429752066115702%;
            }

            .right {
                padding: 4.310344827586206896551724137931%;
                background-color: #ffffff;
            }

            .footer {
                padding: 1.0121457489878542510121457489879%;
                text-align: center;
                background-color: #f1f1f1;
                border: 1px solid #e9e9e9;
                font-size: 0.625em;
            }

            .gridcontainer {
                width: 100%;
            }

            .gridwrapper {
                overflow: hidden;
            }

            .gridbox {
                margin-bottom: 2.0242914979757085020242914979757%;
                margin-right: 2.0242914979757085020242914979757%;
                float: left;
            }

            .gridheader {
                width: 100%;
            }

            .gridmenu {
                width: 28.481781376518218623481781376518%;
            }

            .gridmain {
                width: 38.987854251012145748987854251012%;
            }

            .gridright {
                width: 28.481781376518218623481781376518%;
                margin-right: 0;
            }

            .gridfooter {
                width: 100%;
                margin-bottom: 0;
            }


            .menu-content h4
            {
                color:#9933ff;
            }
            .menu-block
            {
                margin-bottom:50px !important;
            }
            .menu-content
            {
                height : 320px;
                border:1px solid #ccc;
                background-color:#fff;
                font-family:Calibri; 
                border-radius:5px;	 
            }
            .menu-content:hover> .menu-body img
            {
                opacity : 0.8;
                transform : scale(1.3) rotate(10deg);
            }
            .menu-body
            {
                position:relative;
                height:60%;
                border-bottom:1px solid #ccc;
                overflow:hidden;
            }
            .menu-contact
            {
                display:none;
                position:absolute;
                top:0;
                right:0;
                width:80%;
                height:100%;
                background-color:#fff;
                text-align:right;
                padding : 5%;
                opacity:0.93;
                z-index : 1;
            }
            .menu-img
            {
                width:100%;
                height:100%;
                transition : all 0.4s linear;
            }
            .fab
            {
                display:block;
                position:absolute;
                top:174px;
                width:40px;
                height:40px;
                border-radius:50%;
                background-color: /*#ff7c29*/ #415cff;
                padding:10px;
                color:#fff;
                font-size:16px;
                text-align:center;
                box-shadow: 2px 2px 5px #ccc;
                cursor:pointer;
            }
            .menu-footer
            {
                text-align: justify;
                text-justify: inter-word;
                padding:10px;
                font-size:14px;
            }

            <!--
            @media (min-width:1530px){
                .menu-content{height : 450px;}
                .menu-contact{width:70%;}
                .menu-footer{padding-top:30px;}
                .container{margin:0px;margin:auto;width:90%;}
                .footer{height:115px;padding-bottom:20px;}
                .fab{width:50px;height:50px;font-size:25px;top:250px;}
            }
            -->
            @media only screen and (max-width: 1630px) {
                .menu-footer{
                    padding-top:0px;
                    font-size:12px;
                }
                .white-boxx{margin-bottom:90px;}
            }

            @media only screen and (max-width: 900px) {
                .white-boxx{margin-bottom:110px;}
                .gridmenu {
                    display:none;
                }
                .menu-footer{
                    padding-top:0px;
                    font-size:11px;
                }
                .menuitem {
                    margin: 1.0121457489878542510121457489879%;
                    padding: 1.0121457489878542510121457489879%;
                }

                .gridmain {
                    width: 100%;
                }

                .main {
                    padding: 1.0121457489878542510121457489879%;
                }

                .gridright {
                    display:none;
                    /*width: 100%;*/
                }

                .right {
                    padding: 1.0121457489878542510121457489879%;
                }

                .gridbox {
                    margin-right: 0;
                    float: left;
                }
            }
        </style>
    </head>
    <body>
        <div class="gridcontainer">
            <div class="gridwrapper">
                <!--
                <div class="gridbox gridheader">
                        <div class="header">
                                <h1>The Pulpit Rock</h1>
                        </div>
                </div>
                -->

                <div class="gridbox gridmenu">				
                    <div class="mainleft"> <a href="http://iitech-benin.net" class="p-20 di"><img src="https://progiciel.geststudent.net/plugins/images/gsr2.png"></a> </div>
                    <div class="mainleft"><img src="https://progiciel.geststudent.net/plugins/images/po2.png" alt="" width="" height=""></div>
                    <div class="mainleft"><img src="https://progiciel.geststudent.net/images/iitech-logo.png" alt="" width="" height=""></div>
                    <div class="menuitem"><center>@Une production de l'Institut d'Innovation Technologique.</center></div>
                    <div class="menuitem"><center>@IITECH pour des solutions innovantes...</center></div>
                    <div class="menuitem"><center>@@@@@@@@@@@@@@</center></div>
                </div>

                <div class="gridbox gridmain">
                    <div class="main">
                        <!--<h1>The Walk</h1>-->
                        <div class="white-boxx" id = "forgot">	  
                            <h3 class="box-title m-b-0">Sign In to Results</h3>
                            <small>Enter your details below</small>

                            <form method="post" class="form-horizontal new-lg-form" action = "connexion.php" id="loginform">		
                                <?php
                                if (isset($_SESSION['message'])) {
                                    echo '
                                        <div class="error-box2 text-danger text-center">
                                        <i>' . $_SESSION['message'] . '</i>
                                        </div>
                                    ';
                                    unset($_SESSION['message']);
                                }
                                ?>
                                <div class="form-group  m-t-20">
                                    <div class="col-xs-12">
                                        <label>Username</label>
                                        <input class="form-control" type="text" placeholder="Username" name="username"  id = "username"  AUTOCOMPLETE=OFF autofocus>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="col-xs-12">
                                        <label>Password</label>
                                        <input class="form-control" type="password" placeholder="Password" name="password" id = "password" AUTOCOMPLETE=OFF  data-toggle="password">
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="col-md-12">		
                                        <table width = 100%>
                                            <tr >
                                                <td class="checkbox checkbox-info pull-left p-t-0">												
                                                    <a href="javascript:void(0)" id="to-reset" class="text-dark pull-right"><i class="fa fa-lock m-r-5"></i> Reset pwd?</a> 											
                                                </td> 

                                                <td >												
                                                    <a href="javascript:void(0)" id="to-register" class="text-dark pull-left"><i class="fa fa-user m-r-5"></i> Register? </a> 											
                                                </td>

                                                <td>												
                                                    <a href="javascript:void(0)" id="to-recover" class="text-dark pull-right"><i class="fa fa-lock m-r-5"></i> Forgot pwd?</a>																											
                                                </td>
                                            </tr>
                                        </table>
                                    </div>
                                </div>
                                <div class="data"></div>
                                <div class="form-group text-center m-t-20">
                                    <div class="col-xs-12">
                                        <button class="btn btn-info btn-lg btn-block btn-rounded text-uppercase waves-effect waves-light" id = "bouton" type="submit">Log In</button>
                                    </div>
                                </div>
                                <div class="social-box2 text-danger text-center">
                                    <h2>Suivez-nous</h2>			
                                    <div class="form-group">
                                        <div class="social-login-buttons">		
                                            <table width = 100%>
                                                <tr>
                                                    <td>												
                                                        <a class="btn btn-link-1 btn-link-1-facebook" href="https://web.facebook.com/iitechbenin2016/"  target=_blank>
                                                            <i class="fa fa-facebook"></i>
                                                        </a>												
                                                    </td>

                                                    <td>												
                                                        <a class="btn btn-link-1 btn-link-1-twitter" href="https://twitter.com/iitech_benin"  target=_blank>
                                                            <i class="fa fa-twitter"></i> 
                                                        </a>												
                                                    </td>

                                                    <td>												
                                                        <a class="btn btn-link-1 btn-link-1-google-plus" href="https://plus.google.com/104265647563788727011"  target=_blank>
                                                            <i class="fa fa-google-plus"></i> 
                                                        </a>																												
                                                    </td>
                                                </tr>
                                            </table>

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

                            </form>

                            <form class="form-horizontal new-lg-form" id="resetform"  method = "POST" action = "index.php"  data-toggle="validator">
                                <div class="form-group ">
                                    <div class="col-xs-12">
                                        <h3>Reset password</h3>
                                        <p class="text-muted">Enter your details below! </p>
                                    </div>
                                </div>
                                <div class="form-group ">
                                    <div class="col-xs-12">
                                        <input class="form-control" type="text" required="" placeholder="Login" name = "login" id = "login" AUTOCOMPLETE=OFF> 
                                    </div>
                                </div>
                                <div class="form-group ">
                                    <div class="col-xs-12">
                                        <input class="form-control" type="text" required="" placeholder="Verification code" name = "code" id = "code" AUTOCOMPLETE=OFF> 
                                    </div>
                                </div>
                                <div class="form-group ">
                                    <div class="col-xs-12">
                                        <input class="form-control" type="password" required=""  data-toggle="validator"  data-minlength="10" name = "password1" id = "password1"  placeholder="New Password"> 
                                        <span class="help-block">Minimum of 10 characters</span>
                                    </div>
                                </div>
                                <div class="form-group">
                                    <div class="col-xs-12">
                                        <input class="form-control" type="password" required=""  data-match="#password1"  data-match-error="Whoops, these don't match" name = "password2" id = "password2"  placeholder="Confirm Password"> 
                                        <div class="help-block with-errors"></div>
                                    </div>
                                </div>
                                <div class="form-group text-center m-t-20">
                                    <div class="col-xs-12">
                                        <button class="btn btn-info btn-lg btn-block text-uppercase waves-effect waves-light" id = "reset-p" type="submit">Reset</button>
                                    </div>
                                </div>
                                <div class="form-group m-b-0">
                                    <div class="col-sm-12 text-center">
                                        <p>Go to index? <a href="javascript:void(0)" id="to-index-reset" class="text-danger m-l-5"><b>Index</b></a></p>
                                    </div>
                                </div>
                                <div class="social-box2 text-danger text-center">
                                    <h2>Suivez-nous</h2>			
                                    <div class="form-group">
                                        <div class="social-login-buttons">					
                                            <table width = 100%>
                                                <tr>
                                                    <td>												
                                                        <a class="btn btn-link-1 btn-link-1-facebook" href="https://web.facebook.com/iitechbenin2016/"  target=_blank>
                                                            <i class="fa fa-facebook"></i>
                                                        </a>												
                                                    </td>

                                                    <td>												
                                                        <a class="btn btn-link-1 btn-link-1-twitter" href="https://twitter.com/iitech_benin"  target=_blank>
                                                            <i class="fa fa-twitter"></i> 
                                                        </a>												
                                                    </td>

                                                    <td>												
                                                        <a class="btn btn-link-1 btn-link-1-google-plus" href="https://plus.google.com/104265647563788727011"  target=_blank>
                                                            <i class="fa fa-google-plus"></i> 
                                                        </a>																												
                                                    </td>
                                                </tr>
                                            </table>

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

                            <div id="registerform" class="wizard">
                                <ul class="wizard-steps " role="tablist">
                                    <li class="active" role="tab">
                                        <h4><span>1</span>~STEP~</h4> </li>
                                    <li role="tab">
                                        <h4><span>2</span>~STEP~</h4> </li>
                                    <li role="tab">
                                        <h4><span>3</span>~STEP~</h4> </li>
                                </ul>

                                <form class="form-horizontal" id="registerform2"  method = "POST" data-toggle="validator">
                                    <div class="wizard-content">
                                        <div class="wizard-pane active" role="tabpanel">
                                            <div class="form-group ">
                                                <div class="col-xs-12">
                                                    <h3>Create new account...</h3>
                                                    <p class="text-muted">Enter your details below! </p>
                                                </div>
                                            </div>
                                            <div class="form-group ">
                                                <div class="col-xs-12">
                                                    <input class="form-control" type="number" required="" placeholder="Votre matricule" name = "matri" id = "matri" value ="<?php echo $matricule; ?>"  
                                                           AUTOCOMPLETE=OFF> </div>
                                            </div>
                                            <div class="form-group ">
                                                <div class="col-xs-12">
                                                    <input class="form-control" type="text" required="" placeholder="DD/MM/YYYY"  name = "datenaiss" id = "datenaiss"  value ="<?php echo $date_nais; ?>" 
                                                           data-fv-date="true" data-fv-date-format="DD/MM/YYYY" data-fv-date-message = "La date de naissance n'est pas valide : DD/MM/YYYY." 
                                                           AUTOCOMPLETE=OFF> </div>
                                            </div>
                                            <div class="form-group ">
                                                <div class="col-xs-12">
                                                    <input class="form-control" type="text" required="" placeholder="Votre nom d'utilisateur" name = "login" id = "login"  value ="<?php echo $username; ?>" data-fv-regexp="true" data-fv-regexp-regexp="^[a-zA-Z0-9_\.]+$" data-fv-regexp-message="The username can only consist of alphabetical, number, dot and underscore" AUTOCOMPLETE=OFF> </div>
                                            </div>
                                            <div class="form-group m-b-0">
                                                <div class="col-sm-12 text-center">
                                                    <p>Go to index? <a href="javascript:void(0)" id="to-index-register" class="text-danger m-l-5"><b>Index</b></a></p>
                                                </div>
                                            </div>
                                        </div>

                                        <div class="wizard-pane active" role="tabpanel">
                                            <div class="form-group ">
                                                <div class="col-xs-12">
                                                    <h3>Create new account...</h3>
                                                    <p class="text-muted">Enter your details below! </p>
                                                </div>
                                            </div>
                                            <div class="form-group ">
                                                <div class="col-xs-12">
                                                    <input class="form-control" type="password" required=""  data-toggle="validator"  data-minlength="10" name = "motpass1" id = "motpass1"  data-fv-different="true"
                                                           data-fv-different-field="login"
                                                           data-fv-different-message="The password cannot be the same as login" placeholder="Votre mot de passe"> 
                                                    <span class="help-block">Minimum of 10 characters</span>
                                                </div>
                                            </div>
                                            <div class="form-group">
                                                <div class="col-xs-12">
                                                    <input class="form-control" type="password" required=""  data-match="#motpass1"  data-match-error="Whoops, these don't match" name = "motpass2" id = "motpass2"  placeholder="Confirmer le mot de passe"> 
                                                    <div class="help-block with-errors"></div>
                                                </div>
                                            </div>
                                            <div class="form-group ">
                                                <div class="col-xs-12">
                                                    <input class="form-control" type="email" required="" placeholder="Votre adresse mail" name = "adresse" id = "adresse"  value ="<?php echo $email; ?>" AUTOCOMPLETE=OFF> </div>
                                                <div class="help-block with-errors"></div>
                                            </div>
                                        </div>

                                        <div class="wizard-pane active" role="tabpanel">							
                                            <div class="form-group ">
                                                <div class="col-xs-12">
                                                    <h3>Create new account...</h3>
                                                    <p class="text-muted">Enter your details below! </p>
                                                </div>
                                            </div>
                                            <div class="form-group ">
                                                <div class="col-xs-12">
                                                    <input class="form-control" type="number" data-fv-stringlength="true" data-fv-stringlength-min="8"
                                                           data-fv-stringlength-max="8" required="" placeholder="Votre téléphone" name = "phone" id = "phone"  value ="<?php echo $phoneDad; ?>" AUTOCOMPLETE=OFF> </div>
                                            </div>
                                            <div class="form-group ">
                                                <div class="col-xs-12">
                                                    <input class="form-control" type="number" data-fv-stringlength="true" data-fv-stringlength-min="8"
                                                           data-fv-stringlength-max="8" required="" placeholder="Téléphone d'un tuteur" name = "phoneT" id = "phoneT"  value ="<?php echo $phoneDad; ?>" AUTOCOMPLETE=OFF> </div>
                                            </div>
                                            <div class="form-group ">
                                                <div class="col-xs-12">
													<select id = "interface" name = "interface" class="selectpicker m-b-20 m-r-5" data-style="btn-danger btn-outline">
														<optgroup label="==========================GestStudent résultats=========================">
															<option value="" >Choisir votre université</option>
                    										<?php
                    										$i = 0;
                                        					$etablis = $bddg->prepare('SELECT * FROM etablissement');
                                        					$etablis->execute() or die($print_r($etablis->errorInfo()));
                                        					while($data=$etablis->fetch()) {
                                        					    echo '<option value="'.$data['idEtablissement'].'" >'.$data['descreta'].'</option>';
                                        					}
                    										?>										
														</optgroup>
													</select>				
                                                </div>
                                            </div>
                                            <div class="form-group m-b-0">
                                                <div class="col-sm-12 text-center">
                                                    <p>Go to index? <a href="javascript:void(0)" id="to-index-register2" class="text-danger m-l-5"><b>Index</b></a></p>
                                                </div>
                                            </div>
                                        </div>
                                    </div>
                                </form>
                            </div>

                            <form class="form-horizontal" id="recoverform" method = "POST" action = "index.php">
                                <div class="form-group ">
                                    <div class="col-xs-12">
                                        <h3>Recover Password</h3>
                                        <p class="text-muted">Enter your Email and instructions will be sent to you! </p>
                                    </div>
                                </div>
                                <div class="form-group ">
                                    <div class="col-xs-12">
                                        <input class="form-control" type="email" required="" placeholder="Email"  id = "f_mail" name = "f_mail" value ="<?php echo $mail; ?>"   AUTOCOMPLETE=OFF>
                                        <div class="help-block with-errors"></div>
                                    </div>
                                </div>
                                <div class="form-group text-center m-t-20">
                                    <div class="col-xs-12">
                                        <button id ="forgot-p" class="btn btn-primary btn-lg btn-block text-uppercase waves-effect waves-light" type="submit">Send</button>
                                    </div>
                                </div>
                                <div class="form-group m-b-0">
                                    <div class="col-sm-12 text-center">
                                        <p>Go to index? <a href="javascript:void(0)" id="to-index-recorver" class="text-danger m-l-5"><b>Index</b></a></p>
                                    </div>
                                </div>
                                <div class="social-box2 text-danger text-center">
                                    <h2>Suivez-nous</h2>			
                                    <div class="form-group">
                                        <div class="social-login-buttons">					
                                            <table width = 100%>
                                                <tr>
                                                    <td>												
                                                        <a class="btn btn-link-1 btn-link-1-facebook" href="https://web.facebook.com/iitechbenin2016/"  target=_blank>
                                                            <i class="fa fa-facebook"></i>
                                                        </a>												
                                                    </td>

                                                    <td>												
                                                        <a class="btn btn-link-1 btn-link-1-twitter" href="https://twitter.com/iitech_benin"  target=_blank>
                                                            <i class="fa fa-twitter"></i> 
                                                        </a>												
                                                    </td>

                                                    <td>												
                                                        <a class="btn btn-link-1 btn-link-1-google-plus" href="https://plus.google.com/104265647563788727011"  target=_blank>
                                                            <i class="fa fa-google-plus"></i> 
                                                        </a>																												
                                                    </td>
                                                </tr>
                                            </table>

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

                            <br />

                            <div class="menu-block">
                                <div class="menu-content">
                                    <div class="menu-body">
                                        <img src="https://progiciel.geststudent.net/images/Capture_GS_Elections.png" class="menu-img" alt="Images" />
                                    </div>
                                    <div class="menu-footer">
                                        <h4>GS<span class="text-primary"> Elections</span></h4>
                                        <p> 
                                            GS Elections est une application web développée à l’Institut d’Innovation Technologique qui permet de gérer de manière 
                                            efficace les élections rectorales et qui utilise la technique des QR Codes imprimés sur des cartes d’électeurs.	
                                            Elle intègre un module complet de vote qui permet à l’électeur de voter de manière adéquate, assure la 
                                            transparence et la sécurité des informations et offre la possibilité d’avoir les résultats immédiatement  après les élections.
                                        </p>
                                    </div>
                                </div>
                            </div>	
				<iframe width="100%" height="360" src="https://www.youtube.com/embed/eAiHJQjdLW8?list=UUtHcBznEFJwKEK3oXqieD-w" frameborder="0" allow="autoplay; encrypted-media" allowfullscreen></iframe>			

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


                <div class="gridbox gridright">
                    <div class="right">
                        <div class="menu-block">
                            <div class="menu-content">
                                <div class="menu-body">
                                    <img src="https://progiciel.geststudent.net/images/gest.jpg" class="menu-img" alt="Images" />
                                </div>
                                <div class="menu-footer">
                                    <h4>GestStudent<span class="text-primary"> Mobile</span></h4>
                                    <p> Elle constitue à ce jour la seule application de consultation des notes en milieu universitaire avec les offres de formation et 
                                        le parcours de l’ ́etudiant à l’appui. Avec GestStudent Mobile, les étudiants pourront consulter leurs notes avec 0FCFA comme coût 
                                        de déplacement......
                                    </p>
                                </div>
                            </div>
                        </div>
                        <div class="menu-block">
                            <div class="menu-content">
                                <div class="menu-body">
                                    <img src="https://progiciel.geststudent.net/images/22.png" class="menu-img" alt="Images" />
                                </div>
                                <div class="menu-footer">
                                    <h4>GestStudent<span class="text-primary"> NG</span></h4>
                                    <p> C'est une plateforme de génération de sujets QCM et de sa correction de façon automatique. L’épreuve est automatiquement 
                                        générée par le système....
                                    </p>
                                </div>
                            </div>
                        </div>
                        <div class="menu-block">
                            <div class="menu-content">
                                <div class="menu-body">
                                    <img src="https://progiciel.geststudent.net/images/GestTeacher.jpg" class="menu-img" alt="Images" />
                                </div>
                                <div class="menu-footer">
                                    <h4>GestTeacher<span class="text-primary"></span></h4>
                                    <p>
                                        GestTeacher est une application mobile de la plateforme Android qui de par ses fonctionnalitées permet une gestion optimale des notes dans le milieu universitaire. 
                                        Elle en est à sa première version et guarantit une tranparence et une grande facilité dans la gestion des diverses notes 
                                        d'examens concernant une Unité d'Enseignement. 								
                                    </p>
                                </div>
                            </div>
                        </div>
                        <br/>
                    </div>
                </div>


                <div class="gridbox gridfooter">
                    <div class="footer">
                        <h5> Copyright <a href="http://iitech-benin.net"><span class=""><b>Institut d'Innovation Technologique (IITECH Bénin)</b></span></a> &copy; 2013 - <?php $today = getdate(); echo $today['year'] ?></h5>
                        <p>
                            Siège Social : Abomey-Calavi<br/>
                            Numéro IFU : 1201502566402. Tél: (+229) 61374500.<br/>
                            Email: iitech@iitech-benin.net 
                        </p>
                    </div>
                </div>


            </div>
        </div>
        <!-- jQuery -->
        <script src="https://progiciel.geststudent.net/plugins/bower_components/jquery/dist/jquery.min.js"></script>
        <!-- Bootstrap Core JavaScript -->
        <script src="bootstrap/dist/js/bootstrap.min.js"></script>
        <!-- Menu Plugin JavaScript -->
        <script src="https://progiciel.geststudent.net/plugins/bower_components/sidebar-nav/dist/sidebar-nav.min.js"></script>
        <!-- FormValidation -->
        <link rel="stylesheet" href="https://progiciel.geststudent.net/plugins/bower_components/jquery-wizard-master/libs/formvalidation/formValidation.min.css">
        <!-- FormValidation plugin and the class supports validating Bootstrap form -->
        <script src="https://progiciel.geststudent.net/plugins/bower_components/jquery-wizard-master/libs/formvalidation/formValidation.min.js"></script>
        <script src="https://progiciel.geststudent.net/plugins/bower_components/jquery-wizard-master/libs/formvalidation/bootstrap.min.js"></script>
        <!-- Form Wizard JavaScript -->
        <script src="https://progiciel.geststudent.net/plugins/bower_components/jquery-wizard-master/dist/jquery-wizard.min.js"></script>
        <!--slimscroll JavaScript -->
        <script src="js/jquery.slimscroll.js"></script>
        <!--Wave Effects -->
        <script src="js/waves.js"></script>
        <!-- Custom Theme JavaScript -->
        <script src="js/custom.min.js"></script>
        <script src="js/validator.js"></script>
        <!--Style Switcher -->
        <script src="https://progiciel.geststudent.net/plugins/bower_components/styleswitcher/jQuery.style.switcher.js"></script>
        <!-- Sweet-Alert  -->
        <script src="https://progiciel.geststudent.net/plugins/bower_components/sweetalert/sweetalert.min.js"></script>
        <!-- Custom Theme JavaScript -->
        <script src="https://progiciel.geststudent.net/plugins/bower_components/bootstrap-select/bootstrap-select.min.js" type="text/javascript"></script>
        <!-- ================================================== bootstrap-show-password ================================================== -->
        <script src="bootstrap-password-toggler.min.js" type="text/javascript"></script>

        <!-- Désactiver la touche Enter du clavier -->
        <script type="text/javascript">
            loginform.addEventListener("keydown", function (e) {
                if (e.keyCode == 13)
                    e.preventDefault()
            });
        </script>


        <script type="text/javascript">
            (function () {
                $('#registerform').wizard({
                    onInit: function () {
                        $('#registerform2').formValidation({
                            framework: 'bootstrap',
                            excluded: ':disabled',
                            icon: {
                                valid: 'glyphicon glyphicon-ok',
                                invalid: 'glyphicon glyphicon-remove',
                                validating: 'glyphicon glyphicon-refresh'
                            },
                            fields: {
                                matri: {
                                    validators: {
                                        notEmpty: {
                                            message: 'Le matricule est requis'
                                        }
                                    }
                                },
                                fields: {
                                    datenaiss: {
                                        validators: {
                                            date: {
                                                format: 'DD/MM/YYYY',
                                                message: 'La date de naissance n\'est pas valide : DD/MM/YYYY.'
                                            }
                                        }
                                    }
                                },
                                login: {
                                    validators: {
                                        notEmpty: {
                                            message: 'Le nom est requis'
                                        }
                                    }
                                },
                                motpass1: {
                                    validators: {
                                        notEmpty: {
                                            message: 'Le mot de passe est requis'
                                        }
                                    }
                                },
                                motpass2: {
                                    validators: {
                                        notEmpty: {
                                            message: 'Le mot de passe est requis'
                                        }
                                    }
                                },

                                adresse: {
                                    validators: {
                                        notEmpty: {
                                            message: 'The email address is required'
                                        }/*,
                                         emailAddress: {
                                         message: 'The input is not a valid email address'
                                         }*/
                                    }
                                },

                                phone: {
                                    validators: {
                                        notEmpty: {
                                            message: 'Le téléphone est requis'
                                        }
                                    }
                                },
                                
                                phoneT: {
                                    validators: {
                                        notEmpty: {
                                            message: 'Le téléphone est requis'
                                        }
                                    }
                                },
                                
                                interface: {
                                    validators: {
                                        notEmpty: {
                                            message: 'L\'université est requise'
                                        }
                                    }
                                }
                            }
                        });
                    },
                    validator: function () {
                        var fv = $('#registerform2').data('formValidation');
                        var $this = $(this);
                        // Validate the container
                        fv.validateContainer($this);
                        var isValidStep = fv.isValidContainer($this);
                        if (isValidStep === false || isValidStep === null) {
                            return false;
                        }
                        return true;
                    },
                    onFinish: function () {
                        //$('#validation').formValidation('defaultSubmit');
                        swal({
                            title: "Confirmer l'opération?",
                            text: "",
                            type: "info",
                            showCancelButton: true,
                            closeOnConfirm: false,
                            showLoaderOnConfirm: true,
                            confirmButtonClass: "btn-danger",
                            confirmButtonText: "Yes, confirm it!",
                            confirmButtonColor: "#ec6c62"
                        },
                                function () {
                                    setTimeout(function () {
                                        $.ajax({
                                            url: "newuser.php",
                                            type: "POST",
                                            data: new FormData($('#registerform2')[0]),
                                            async: false,
                                            processData: false, // tell jQuery not to process the data
                                            contentType: false, // tell jQuery not to set contentType
                                            dataType: "json",
                                            success: function (response) {
                                                swal({
                                                    title: "Votre compte utilisateur GestStudent est crée avec succès.. ",
                                                    text: "Vous pouvez à présent vous connceter..",
                                                    type: "success"
                                                },
                                                        function () {
                                                            location.reload();
                                                        }
                                                );
                                            },
                                            error: function (response) {
                                                swal({
                                                    title: "",
                                                    text: "" + response.responseText,
                                                    type: "error",
                                                    closeOnConfirm: false,
                                                    showLoaderOnConfirm: true,
                                                    confirmButtonClass: "btn-danger",
                                                    confirmButtonText: "OK",
                                                    confirmButtonColor: "#ec6c62"
                                                });
                                            }
                                        });
                                    }, 100);
                                });
                    }
                });
            })();
        </script>
        <script>
            $(function () {
                //$(".fab").addClass('animated infinite swing');
                $(".fab").on('click', function () {
                    $(this).parent().prev().find('.menu-contact').toggle();
                    $(this).parent().prev().find('.menu-contact').addClass('animated slideInRight');
                })
            })
        </script>

    </body>
</html>

<?php
if (isset($_POST['f_mail'])) {
    $email = $_POST['f_mail'];
    $query = "select * from users_student where email = :mail Limit 1";
    $statement = $bddg->prepare($query);
    $statement->bindParam(':mail', $email, PDO::PARAM_STR);
    $statement->execute();
    $row = $statement->fetch(PDO::FETCH_ASSOC);
    $username = $row['username'];
    $code = mt_rand();
    $nb = $statement->rowCount();
    //$resultat = false;
    if ($nb == 1) {
        //$resultat = true;
        $delete = "delete from verification where login = :user ";
        $statement1 = $bddg->prepare($delete);
        $statement1->bindParam(':user', $username, PDO::PARAM_STR);
        $statement1->execute();

        $query = "insert into verification (login, code) values (:login, :code)";
        $statement2 = $bddg->prepare($query);
        $statement2->bindParam(':login', $username, PDO::PARAM_STR);
        $statement2->bindParam(':code', $code, PDO::PARAM_STR);
        $statement2->execute();

        $expediteur = 'iitech@iitech-benin.net'; // L'email de l'exp&eacute;diteur.
        $message = "Hello, <br /><br />You request to reset the password of your account GestStudent. <br /><br />To reset, you must enter the verification code to confirm that it is a legitimate request. <br /><br />The verification code is : $code.<br /><br />With best and warm regards.";
        $message = str_replace('<br />', "\n", $message); // message trait&eacute; pour les sauts de ligne
        $to = "$email"; // e-mail du destinataire
        $subject = 'Your password reset request for GestStudent';
        $headers = 'From: ' . $expediteur . "\r\n";   // en-tête de l'e-mail
        $retval = mail($to, $subject, $message, $headers);
        if ($retval == true) {
            echo "<script>swal('Le message est envoyé avec succès...', '', 'info');</script>";
        } else {
            echo "<script>swal('Echec d\'envoie du message......', '', 'error');</script>";
            echo "<<script type=\"text/javascript\">
				$('#recoverform').css('display','block');
				$('#loginform').css('display','none');
			</script>";
        }
    } else {
        echo "<script>swal('L\'adresse email : $email n\'existe pas. Echec d\'envoie du message...', '', 'error');</script>";
        //echo "<script>alert('L\'adresse email : $email n\'existe pas. Echec d\'envoie du message...'); document.location.href='index.php';</script>";	
    }
}

if (isset($_POST['login']) && isset($_POST['code']) && isset($_POST['password1'])) {
    $login = $_POST['login'];
    $code = $_POST['code'];
    $motpass1 = $_POST['password1'];
    $motpass1 = password_hash($motpass1, PASSWORD_DEFAULT);//crypt($motpass1, 'superhashcode');
    $query = "select * from verification where code = :code and login = :login Limit 1";
    $statement = $bddg->prepare($query);
    $statement->bindParam(':code', $code, PDO::PARAM_STR);
    $statement->bindParam(':login', $login, PDO::PARAM_STR);
    $statement->execute();
    $nb = $statement->rowCount();
    if ($nb == 1) {
        date_default_timezone_set('Africa/Porto-Novo');
        $updated_at = date('Y-m-d H:i:s');
        $query1 = "update users_student set password = :pass, updated_at = :date where username = :user";
        $statement1 = $bddg->prepare($query1);
        $statement1->bindParam(':pass', $motpass1, PDO::PARAM_STR);
        $statement1->bindParam(':date', $updated_at, PDO::PARAM_STR);
        $statement1->bindParam(':user', $login, PDO::PARAM_STR);
        $statement1->execute();
        $nb1 = $statement1->rowCount();
        if ($nb1 == 1) {
            $delete = "delete from verification where login = :user ";
            $statement = $bddg->prepare($delete);
            $statement->bindParam(':user', $login, PDO::PARAM_STR);
            $statement->execute();
            echo "<script>swal('Votre mot de passe est mise à jour avec succès...','','info');</script>";
        } else {
            echo "<script>swal('Echec de la mise à jour du mot de passe...', '', 'error');</script>";
        }
    } else {
        echo "<script>swal('Login ou code incorrecte...', '', 'error');</script>";
        echo "<<script type=\"text/javascript\">
			$('#resetform').css('display','block');
			$('#loginform').css('display','none');
		</script>";
    }
} else {
    //alert2("Bien vouloir renseigner les options...", 'error', 'reset.php');
    //echo "<script>swal('Votre mot de passe est mise à jour avec succès...','','info'); document.location.href='index.php';</script>";	
}
?>
