<?php session_start();
require('config.php');
if(isset($_POST['username']) && isset($_POST['password']))
{
$username=mysqli_real_escape_string($con , htmlspecialchars(trim($_POST['username'])));
$password=mysqli_real_escape_string($con ,  htmlspecialchars(trim($_POST['password'])));
    $password=md5($password);
$result=mysqli_query($con,"SELECT * FROM users WHERE username='$username'  && password='$password'");
$count=mysqli_num_rows($result);

if($count==1)
{
$row=mysqli_fetch_array($result);
if($row['etat']=="0") {
   echo "inactive";
  } else{
    $_SESSION['user_connect_id']=$row['id'];
    $_SESSION['user_connect_grade']=$row['type'];

    echo 1;
  }
}  else{
echo $count;
}
}
?>
