<?php
ob_start();   
session_start();
include 'connection.php';
if($_SERVER['REQUEST_METHOD'] == "POST") {
    //mysql_connect("connection.php", "username", "password");
    //@mysql_select_db("database") or die( "Unable to connect to database");
    $username = $_POST['username'];
    $password = $_POST['password'];

    $query = "SELECT * FROM mst_users WHERE user_name ='$username' AND password='$password'";
  
  $result = mysqli_query($conn,$query);
    if(mysqli_num_rows($result) > 0) {
      $_SESSION['is_logged_in'] = 1;
    $LOGIN_NAME = $_POST['username'];
    $EMPLOYEE_PASSWORD = $_POST['password'];
   
    
    $_SESSION["LOGIN_NAME"] = $LOGIN_NAME;
    $_SESSION["EMPLOYEE_PASSWORD"] = $EMPLOYEE_PASSWORD;
  
  
    }
  }
//exit();
  if(!isset($_SESSION['is_logged_in'])) {
header("location:login.php");
}
else {
      header("location:index.php");}
?>




