<?php
error_reporting(0);
 include ('config.php');

$array1=array();
	{
		if (!empty($_POST['new_password'])&&($_POST['email'])&&($_POST['otp'])) 
		{
    $email = $_POST['email'];
	$new_password = $_POST['new_password'];
	$otp = $_POST['otp'];
	
    $sel = "select * from re_candidate where email = '$email' and otp = '$otp'";
	$userchk = mysqli_query($conn,$sel);
	while($rot = mysqli_fetch_array($userchk))
	{
		 $uid = $rot['email'];
		  $otpp = $rot['otp'];
		}
	if ($email==$uid || $otp==$otpp)
	{
		 $upd = "UPDATE re_candidate SET password='$new_password' where email='$email'";
		$osd = mysqli_query($conn,$upd);
	//	$array1['status']="true";
		//$array1['msg']="Password change successfully";
		 $array1 = array("response"=>array("status" => "true", "msg" => "Password change successfully."));
	}

	
		else
		{
		//	$array1['status']="false";
		//	$array1["msg"]= "Password not matched please enter correct old password";
			 $array1 = array("response"=>array("status" => "false", "msg" => "Password not matched please enter correct old password."));
		}
				
	
		}
		
	else
	{
		//$array1['status']="false";
		//$array1["msg"]= "Password not matched please enter correct old password12";
		 $array1 = array("response"=>array("status" => "false", "msg" => "Enter all parameters!"));
	}
	echo json_encode($array1);
	}
	
?>