<?php session_start(); ?>

<!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>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<style type="text/css">
<!--
body {
	background-color: #0099FF;
}
.style2 {
	font-size: 16px;
	font-weight: bold;
}
-->
</style></head>


<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Agenda</title>
</head>
<body>
<form method="post" action="menuadminPass.php">
</br>

<table width="372" border="2" align="center">

  <tr>
    <td align="center"><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN">
      <span class="style2"><br />
Accès réservé aux personnes autorisées:<br /> 
Identifiez vous ! </span></td>
  </tr>
  <tr>
    <td width="360" align="center">&nbsp; 
      <label>Nom de l'utilisateur : </label><input type="text" name="login" onclick="this.value=''"/></td>
  </tr>
  <tr>
    <td align="center">&nbsp; <label>Mot De Passe : &nbsp;</label>
      <input type="password" name="pass" onclick="this.value=''" /></td>
  </tr>
  <tr>
    <td align="center"> &nbsp;
       <input type="submit" name="envoi" value="Entrer"/></td>
  </tr>
</table>
</form>
<div>
<?php

if(isset($_POST['envoi'])){
$login=$_POST['login'];
$pass=$_POST['pass'];
include("_serveur.php");
$sql = 'SELECT * FROM users where username= "'.$login.'" and password="'.$pass.'"and type="1"';
if(!(mysqli_query($link, $sql))){
    echo "ERROR: Could not able to execute $sql. " . mysqli_error($link);
}
$req=mysqli_query($link, $sql);
while ($data = mysqli_fetch_array($req)) 
 {
 $username1=$data['username'];
 $pass1=$data['pass'];
 $classe1=$data['classes'];
 $_SESSION['classe1']=$classe1;
$_SESSION['pass1']=$pass1;
$_SESSION['username1']=$username1;

echo '<META HTTP-EQUIV="Refresh" Content="0; URL=menuadmin.php">';    

 }
}
?>
</div>
</body>
</html>