<?php 
ob_start();
session_start();
include '../config/config.php';
include '../config/function.php';
if($_SESSION['member_user_id']=='')
{
    header("Location:../Login");
    exit();
}
$member_user_id=$_SESSION['member_user_id'];
$strP="Select password from tbl_memberreg where member_user_id='$member_user_id'";
$password=get_value($strP);

echo $oldPassword=trim($_REQUEST['oldPassword']);
echo $newPAssword=trim($_REQUEST['newPAssword']);   
echo $cpassword=trim($_REQUEST['cpassword']);
if($password!=$oldPassword)
{
    $msg="Wrong Old Password";
}
else if(strlen($newPAssword)<4)
{
    $msg="Password Must have be minimum 4 Charactor ";
}
else if($cpassword!=$newPAssword)
{
    $msg="New Password and Confirm Password Not Same ";
}
else
{
    echo $UpPass="Update tbl_memberreg set password='$newPAssword' where member_user_id='$member_user_id'";
    mysqli_query($connection,$UpPass) or die(mysqli_error($connection));
    $msg="Password Change Successfully ";
}
header("Location:../ChangePassword?msg=$msg");
exit()

?>