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

$array1=array();
	{
		if (!empty($_POST['new_password'])&&($_POST['user_id'])&&($_POST['old_password'])) 
		{
    $user_id = $_POST['user_id'];
	$new_password = $_POST['new_password'];
	$old_password = $_POST['old_password'];
	//echo "select * from re_candidate where can_id = '$user_id' and password = '$old_password'";
    $sel = "select * from re_candidate where can_id = '$user_id' and password = '$old_password'";
	$userchk = mysqli_query($conn,$sel);
	while($rot = mysqli_fetch_array($userchk))
	{
		 $uid = $rot['user_id'];
		  $old_pass = $rot['password'];
		}
	if ($user_id==$uid || $old_password==$old_pass)
	{
		 $upd = "UPDATE re_candidate SET password='$new_password' where can_id='$user_id'";
		$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);
	}
	
?>