<?php
include_once 'includes.php';
$msg='';
if($_SERVER["REQUEST_METHOD"] == "POST"){
   $oldpassword=$_POST['oldpassword']; // Old password
   $newpassword=$_POST['newpassword']; // New Password
   $cpassword=$_POST['cpassword']; // Confirm new password
   if(strlen($oldpassword)>0 && strlen($newpassword)>0 && strlen($cpassword)>0) {
	   // If all the value is correct then
	   // Insert the new password from data
      $password=$Mat->ChangeSecretPassword($oldpassword, $newpassword, $cpassword,$uid);
      if($password) {
		  // If password changed then show message
	     $msg="<span class='succ'>Password changed successfully.</span>";
       } else {
		   // Else if password show the error message
	       $msg="<span class='error'>Please give valid Old Password and Confirm Password.</span>";
       }
       } else {
       $msg="<span class='error'>Please give valid details.</span>";
     }
}
?>