<?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';

extract($_POST);
$data = $_REQUEST;

$to  = trim($_REQUEST['mobile']);
$otp = trim($_REQUEST['otp']);


$data = findQuery("SELECT * FROM ca_otp WHERE mobile ='$to' AND code='$otp' and status=0");


if ($data) {
    $id = $data[0]['id'];

    updateQuery("UPDATE ca_otp SET status=1 where id=$id");

    $message = 'True';
} else {
    $message = 'false';
}

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

return;
?>	   

