<?php include("../cn.php");
$id = $_REQUEST["id"];
$old_pass = $_REQUEST["old_pass"];
$new_pass = $_REQUEST["new_pass"];
$confirm_pass = $_REQUEST["confirm_pass"];

$sql = mysqli_query($connect, "select * from users where Id='$id'");
$data = mysqli_fetch_assoc($sql);
if($old_pass!=$data["Password"]){
	
	echo "Your old password is not correct. Please re-type.";
} else if($new_pass!=$confirm_pass){
	echo "Your new passwords do not match. Please re-type.";
} else{
	mysqli_query($connect, "update users set Password = '$new_pass' where Id='$id'");
	$_SESSION["password"] = $new_pass;
}


?>