<?php
require 'inc.php';
if($obj_ctl_user->version!="xxgo.net") exit("系统整合了".$obj_ctl_user->user_version."，不需要在这里管理用户！");
if(defined("WEB_ADMIN_DOUBLE")&&WEB_ADMIN_DOUBLE!=1){
	exit("系统没有设置二次验证功能，不需要设定管理密码！");
}
$obj_tab_admin=new cls_tab_sys_admin();
if($get_act=="save"){
	if(!isset($get_oldpwd)){
		$obj_msg->alert("请输入原密码！");
		$obj_msg->on_history_back();
		exit;
	}
	if(!isset($get_pwd1)){
		$obj_msg->alert("请输入新密码！");
		$obj_msg->on_history_back();
		exit;
	}
	if(!isset($get_pwd2)){
		$obj_msg->alert("请输入确认密码！");
		$obj_msg->on_history_back();
		exit;
	}
	if($get_pwd2!=$get_pwd1){
		$obj_msg->alert("两次输入密码不相等！");
		$obj_msg->on_history_back();
		exit;
	}
	$obj_result = $obj_db->query("SELECT * FROM ".DB_PRE."sys_admin a left join ".DB_PRE."sys_user b on a.admin_user_id=b.user_id where admin_user_id='".$obj_ctl_user->id."'");
	if($obj_rs = $obj_db->fetch_array($obj_result))
	{
		$str_pwd=get_pwd($get_oldpwd);
		if($str_pwd!=$obj_rs["admin_pwd"]){
			$obj_msg->alert("输入原密码不正确！");
			$obj_msg->on_history_back();
			exit;
		}
		$arr_fields=array();
		$arr_fields["admin_id"]=$obj_rs["admin_id"];
		$arr_fields["admin_pwd"]=$get_pwd1;
		$arr_msg=$obj_tab_admin->on_save($arr_fields);
		if($arr_msg["err"]!=""){
			$obj_msg->alert($arr_msg["err"]);
		}else{
			$obj_msg->alert("成功修改密码！");
		}
	}else{
		$obj_msg->alert("您不是管理员，没有权限！");
		exit;
	}
}
include 'tpl/mypwd.tpl.php';

?>
