<?php
include('./cms_inc.php');
include('./cms_check.php');
if (isset($_POST['save'])) {
	if (md5($_POST['a_opassword']) != $admin_password) {
		alert_back('当前密码错误，请核实。');
	}
	$_data['a_password'] = md5($_POST['a_password']);
	$sql = 'update cms_admin set '.arrtoupdate($_data).' where id = '.$admin_id.'';
	if(sql_query($sql)){
		alert_href('密码修改成功!','cms_password.php');
	}else{
		alert_back('error');
	}
}
?>
<!doctype html>
<html>
<head>
<?php include('./cms_inc_head.php') ?>
</head>
<body>
<div id="layout">
	<?php include('./cms_inc_header.php') ?>
	<div id="main">
		<div id="content">
			<?php include('./cms_inc_left.php') ?>
			<div id="right">
				<div class="hd-1">修改密码</div>
				<div class="bd-1">
					<form method="post">
						<div class="form-group">
							<div class="label"><label for="a_opassword">当前密码</label></div>
							<div class="field">
								<input id="a_opassword" class="input" name="a_opassword" type="password" maxlength="255" size="60" value="" data-validate="required:必须填写" />
							</div>
						</div>
						<div class="form-group">
							<div class="label"><label for="a_password">新密码</label></div>
							<div class="field">
								<input id="a_password" class="input" name="a_password" type="password" maxlength="255" size="60" value="" data-validate="required:必须填写" />
							</div>
						</div>
						<div class="form-group">
							<div class="label"><label for="a_cpassword">重复新密码</label></div>
							<div class="field">
								<input id="a_cpassword" class="input" name="a_cpasswored" type="password" maxlength="255" size="60" value="" data-validate="required:必须填写,repeat#a_password:两次输入的密码不一致" />
							</div>
						</div>
						<div class="form-group">
							<div class="label"><label></label></div>
							<div class="field">
								<input id="save" class="btn bg-dot" name="save" type="submit" value="修改密码" />
							</div>
						</div>
					</form>
				</div>
			</div>
		</div>
	</div>
	<?php include('./cms_inc_footer.php') ?>
</div>
</body>
</html>