<?php

session_start();
include("../php_crud/my_class.php");
$obj = new my_class();
extract($_REQUEST);
$uid  = $_SESSION["LOGIN_USERID"];

$old_pass = md5(trim($_REQUEST['old_password']));
$password = md5(trim($_REQUEST['password']));


$start_date = date('Y-m-d');
$end_date = date('Y-m-d', strtotime("+60 days"));
	  
	
	  $tablee = '_pf_emp_personal_info';
	  $where = '_uniq_id='.$uid ;
	 
	  $row_user = $obj->Details_By_Cond($tablee,$where);
	  $user_old_pass = $row_user['_pass_word'];	
	
	
	if($old_pass == $user_old_pass && $old_pass != $password){
		 
		$tablee = '_pf_emp_personal_info';
		$set_data = array(
			'_pass_word'  => $password,
			'_login_status' => 'A',
			'_user_expire_date' =>$end_date
		
		);
		 $update_query =  $obj->Update_Data($tablee, $set_data, $where) ;
		 if($update_query){
			
			 echo "success";
			 session_destroy();
		 }
	}
	else {
		if($old_pass != $user_old_pass){
			echo 'error';
			
		}
		if($old_pass == $password){
			echo 'error2';
		}
	}
	
 
 
 ?>