<?php
include "control/activity.php";
$dd = new activity();
$amnt = $_REQUEST["amnt"];
$utr = $_REQUEST["utr"];
$user = $_REQUEST["user"];
$amntINR = $_REQUEST["amntINR"];

if ($amnt == "" || $utr == "" || $user == "") {
    print_r(
        json_encode([
            "status" => "failed",
            "remark" => "All Field are Required ",
        ])
    );
} else {
    $table = "funds_request";
    $condition = " where refrence_number='$utr'";
    $checkDetails = $dd->check($table, $condition);
    if ($checkDetails["status"] != "success") {
        $date = date("h:i d/m/Y");
        $ref = mt_rand(1111111111, 9999999999);
        $table = "funds_request";
       $value = "(`userKey_id`, `request_date`, `request_type`, `amount`, `AmountInDollar`, `refrence_number`) 
    VALUES ('$user','$date','INR','$amntINR','$amnt','$utr')";
         $result = $dd->insertData($table, $value);
        if ($result) {
            print_r(
                json_encode([
                    "status" => "success",
                    "remark" => "Request sending Successfull..!!",
                ])
            );
        }
    } else {
        print_r(
            json_encode([
                "status" => "failed",
                "remark" => "UTR Alreaady Exist.!!",
            ])
        );
    }
}

?>
