<?php


	if(!isset($_REQUEST['memberID']) || empty($_REQUEST['memberID'])){
		$validErr = "Please Enter Member ID";
	} else if(!isset($_REQUEST['emailID']) || empty($_REQUEST['emailID'])){
		$validErr = "Please Enter Email Address";
	} 

	if(isset($validErr) )
	{
		$result['status'] = 0;
		$result['message'] = $validErr;
		echo json_encode($result);exit;
	}

	if(isset($_POST['otpRequest']) && $_POST['otpRequest']=="yes" && empty($_POST['otp_received'])):

		//$url = "http://localhost/marvel/API/API_send_otp.php";
		$url = "http://localhost/MyBooster/API/API_send_otp.php";
		$data['OTPResponse'] = true;

	else:

		//$url = "http://localhost/marvel/API/API_forgot_password.php";
		$url = "http://localhost/MyBooster/API/API_forgot_password.php";
		$params['email_address'] =  $_POST['emailID'];
		$params['HTTP_USER_AGENT'] = urlencode($_SERVER['HTTP_USER_AGENT']);
		$params['otp'] =  $_POST['otp_received'];
		$data['OTPResponse'] = false;

	endif;
	
	$params['section']='1';
	$params['refer_id'] = $_POST['memberID'];
	$params['emailID'] = $_POST['emailID'];

	
	$data_string = http_build_query($params);

    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_HEADER, 0);
    curl_setopt($ch, CURLOPT_POST, 1);
    curl_setopt($ch, CURLOPT_POSTFIELDS, $data_string);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($ch, CURLOPT_VERBOSE, 0);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);

    $output = curl_exec($ch);
    $status = curl_getinfo($ch, CURLINFO_HTTP_CODE);

    $response = json_decode($output, true);
    $response = array_merge($response, $data);


    $response = json_encode($response);

    print $response;exit;




?>