<?php
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: POST, GET, OPTIONS');
header('Access-Control-Max-Age: 1000');
header('Access-Control-Allow-Headers: Content-Type');
require_once('../lib/dbclass.php');

$email = trim($_REQUEST['email']);
$pwd   = trim($_REQUEST['password']);
$pwd   = encrypt($pwd);

$user = findQuery("select * from tbl_user where username='$email' and password='$pwd' and status=0");

if ($user[0]['id']) {
    $message          = 'true';
    $Userid           = $user[0]['id'];
    $CollectionAgents = 0;

    $data2[] = [

        'id'         => trim($user[0]['id']),
        'name'       => trim($user[0]['name']),
        'Usertype'   => trim($user[0]['user_type']),
            'mobile' => trim($user[0]['mobile']),

        ];
} else {
    $message = 'false';
    $data2[] = ['error' => 'Invalid Credentials'];
}

echo json_encode(['Status' => $message, 'data' => $data2]);

return;

?>

