<?php   
include '../config/config.php';
$obj=new Database();
$b=[];   
$id=$_POST['id'];
$pass=$_POST['psw'];
// $id="admin";
// $pass="Admin";
$id="user_id='".$id."' and password='".md5($pass)."'";
$obj->select('user','*',null,$id,null,null);
$result=$obj->getResult();       
if($result)         
{
      foreach($result as $row)
      {   
            session_start();
            $_SESSION['id']=$row['id'];
            $_SESSION['start'] = time();  
            $_SESSION['level'] = $row['access_level'];  
            
            // Destroying session after 1 minute 
            $_SESSION['expire'] = $_SESSION['start'] + (1 * 10) ; 
            array_push($b,$row); 
      }     
}    
else
{
   array_push($b,'0'); 
}
header('Content-type:application/json');
echo json_encode($b);
?>