<?php
include("config.php");

$fone=$_POST['fone'];
$pass=$_POST['pass'];

$sql=mysqli_query($db,"select * from users where phone='$fone' AND password='$pass'");
if(mysqli_num_rows($sql))
{
    $row=mysqli_fetch_assoc($sql);
    
    $uid=$row['id'];
    $status=$row['status'];
    $name=$row['name'];
    
    if($status=="Active")
    {
        $res=1;
    $msg="successfully logged in";
    }
    else
    {
        $res=0;
    $msg="user inactive";
    }
}
else
{
    $res=0;
    $msg="user not found";
}

$json=array(
    'response' => $res,
    'message' => $msg,
    'user_id' => $uid,
    'user_name' => $name,
    'class' => array(
        'class_id' => $class,
        'class_name' => $cname
        )
    );
    
    $jsonencode=json_encode($json);
    
    print_r($jsonencode);
    ?>