<?php 
/**
 * 修改密码
 */
	if(!defined('IN_SYS'))exit('crack die-php188');
	if(is_post()){
		$o = $_POST['o'];
		$n1 = $_POST['n1'];
		$n2 = $_POST['n2'];
		if(empty($o))exit($sp->bgmsg('请输入旧密码'));
		if(strlen($n1)<6)exit($sp->bgmsg('密码必须在6位以上'));
		if($n1!=$n2)exit($sp->bgmsg('两次密码不一致.'));
		$name = $_SESSION['admin_user'];
		$c = $db->fetch("SELECT * FROM ##__admin WHERE `admin_user` = '$name';",TRUE);
		if(empty($c)){
			@session_destroy();
		}
		if(trim($c['admin_pwd'])!=md5($o))exit($sp->bgmsg('旧密码错误.'));
		$db->update(array('admin_pwd'=>md5($n1)),'admin',array('admin_user'=>$name));
		@session_destroy();
		$sp->bgmsg('密码修改成功');
	}
	$navs = '修改用户密码';
	$tpl->assign('admin_nav',shownav($navs));
	$tpl->display('channge_pass.tpl');
?>