<?php
//****************************************请求权限******************************************
require("locked.php");                                                                 //*
//****************************************************************************************
$page_title='修改密码—恩格会计管理系统'; 
include("header.php");

include("cnn.php");
$oldpwd=md5($_POST[txt1]);
$newpwd=md5($_POST[txt2]);
$sql=$mysqli->query('select * from user where id="'.$_SESSION[userid].'" and password="'.$oldpwd.'"');
$info=$sql->fetch_array(MYSQLI_BOTH);
if(!$info){
	echo '<div align="center">您输入的旧密码不正确；<a href="#" onclick="javascript:history.back()">返回</a></div>';
}else{
	$updateSql=$mysqli->query('update user set password="'.$newpwd.'" where id="'.$_SESSION[userid].'"');
	if($updateSql){
		echo '<div align="center">密码修改成功；<a href="#" onclick="javascript:history.back()">返回</a></div>';
	}else{
		echo '<div align="center">密码修改失败；<a href="#" onclick="javascript:history.back()">返回</a></div>';
	}
}
$sql->free();
$mysqli->close();

include("footer.php");
?>