<?php
    try {
        include("../main.php");
        $request = json_decode(file_get_contents('php://input'));
        extract((array) $request);
        $query = "SELECT * FROM `users` WHERE `email` = '$email' AND `status` IN ('1','0')";
        $dbobjx->query($query);
        $return = $dbobjx->single();
        // print_r($return->password);die;
        if ($return == true) {
            // if (verifyPassword($password, $return->password)) {
            if ($password === $return->password) {
                if ($return->status) {
                    echo response(1, "SUCCESSFULLY OPERATED", $return);
                } else {
                    echo response(0, "ACCOUNT DEACTIVATED!", []);
                }
            } else {
                echo response(0, "INVALID PASSWORD!", []);
            }
        } else {
            echo response(0, "INVALID EMAIL!", []);
        }
        $dbobjx->close();
    } catch (Exception $error) {
        echo response(0, "API ERROR!, UNPROCESSABLE ENTITY", $error->getMessage());
    }
