<?php
/**
 * Created by PhpStorm.
 * User: Ludah
 * Date: 8/31/2017
 * Time: 5:19 PM
 */

include "../../../config/connection.php";
include "../../config/functions/func_init.php";
if ($_SERVER['REQUEST_METHOD'] == "POST") {

    /*
     * Json Accept values(action,kiv,ksp,phoneNumber)
     *
     */

    $response = array();
    $request = array();
    $request = json_decode(file_get_contents("php://input"), true);
    $action = $request['action'];
    if($request['kiv'] ==  "PG001" AND $request['ksp'] == "PG002"){
        if($action == 300){
            if(v_check_number_exist($dbc,$request['phoneNumber'])){
                $response['status'] = "SUCCESSFUL";
                $response['status-code'] = "0";
            } else{
                $response['status'] = "ERROR";
                $response['status-code'] = "1";
            }
        } else{
            $response['status'] = "ERROR";
            $response['status-code'] = "2";
        }
    }else{
        $response['status'] = "ERROR";
        $response['status-code'] = "3";
    }


    echo json_encode($response);




}
