<?php
include_once("inc/conn.php");
include_once("inc/function.php");
login_check();
if($_GET["act"]=="modifyPwd"){
	if($_POST["tbNewPwd"]!=$_POST["tbRePwd"]){
		echo "<script language=javascript>alert('对不起，两次输入的新密码不一致！');history.go(-1);</script>";
		exit;
	}
	if($_POST["tbOldPwd"]==$_POST["tbNewPwd"]){
		echo "<script language=javascript>alert('对不起，密码修改失败或者没有修改密码！');history.go(-1);</script>";
		exit;
	}
	$query_f=$db->query("Select id From {$web_dbtop}users where id=" .intval($_COOKIE["usersid"]). " And password='" .md5(trim($_POST["tbOldPwd"])). "'");
	if($rs_f=$db->fetch_array($query_f)){
		$db->query("update {$web_dbtop}users set password='" .md5(trim($_POST["tbNewPwd"])). "' where id=".$rs_f["id"]."");
		setcookie("password",md5(trim($_POST["tbNewPwd"])));
		echo "<script language=javascript>alert('密码修改成功！');location.href='userpwd.php';</script>";
		exit;
	}else{
		echo "<script language=javascript>alert('对不起，输入的旧密码错误！');history.go(-1);</script>";
		exit;
	}
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3c.org/TR/1999/REC-html401-19991224/loose.dtd">
<HTML xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>用户中心-<?=$web_name;?></title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<meta name="keywords" content="<?=$web_keywords;?>" />
<meta name="description" content="<?=$web_description;?>" />
<META http-equiv=X-UA-Compatible content=IE=EmulateIE7>
<link href="style/default.css" rel="stylesheet" type="text/css" />
</head>
<?php include_once("top.php");?>
<script language="javascript">
qiehuan(7);
document.getElementById("qh_con7").getElementsByTagName('li')[10].className="current";
</script>
<DIV class="wrapper">
	<DIV class="page_content">
  		<!--主体右边 Start-->
    	<div class="area260 fl">
			<DIV class="news-title">
				<span><a href="news_lest.php">更多&raquo;</a></span>
				 <H3>站内公告</H3>
			</DIV>
			<ul class="area260-info news-list">
				<?
				$query=$db->query("Select * from {$web_dbtop}news Order by top desc,id desc limit 10");
				while($rs=$db->fetch_array($query)){
				?>
				<LI><A title="<?=$rs["title"]?>" href="news_content.php?id=<?=$rs["id"]?>"><?=$rs["title"]?></A></LI>
				<?
				}
				?>
			</ul>
			 <DIV class="area260-b h5px"></DIV>
			 <DIV class=blank10></DIV>
			 <DIV class="news-title">
				<span><a href="help_lest.php">更多&raquo;</a></span>
				 <H3>用户帮助</H3>
			</DIV>
			<ul class="area260-info news-list">
				<?
				$query=$db->query("Select * from {$web_dbtop}help Order by top desc,id desc limit 10");
				while($rs=$db->fetch_array($query)){
				?>
				<LI><A title="<?=$rs["title"]?>" href="help_content.php?id=<?=$rs["id"]?>"><?=$rs["title"]?></A></LI>
				<?
				}
				?>
			</ul>
			 <DIV class="area260-b h5px"></DIV>
			 <DIV class=blank10></DIV>
		</div>
		<!--主体左边 Start-->
		<div class="area690 fr">
			<DIV class="users-title">
				 <H3>修改密码</H3>
			</DIV>
        	<div class="users-content">
				<form action="?act=modifyPwd" method="post" enctype="multipart/form-data">
        		<ul class="bgk">
					<li class="b21"><span style="padding-left:66px">旧密码：</span></li>
					<li class="b22"><span style="padding-left:5px"><input name="tbOldPwd" class="input170" type="password" /></span></li>
					<li class="b21"><span style="padding-left:66px">新密码：</span></li>
					<li class="b22"><span style="padding-left:5px"><input name="tbNewPwd" class="input170" type="password" /></span></li>
					<li class="b21"><span style="padding-left:42px">重复新密码：</span></li>
					<li class="b22"><span style="padding-left:5px"><input name="tbRePwd" class="input170" type="password" /></span></li>
					<li class="tj"><input id="btnSubmit" type="image" src="images/an_ljtj_03.gif"  border="0" /></li>
				</ul>
				</form>
			</div>
			<div class="area690-b h5px"></div>
        	<div class="blank10"></div>
		</div>
		<!--主体左边 End-->
	</DIV>
	<!--Flink End-->
	<div class="blank10"></div>
	<!--Footer Start-->
<?php include_once("footer.php");?>
</DIV>