<?php
	if (!Tourists()){ exit ('请登录后使用此功能！'); }

	if (!empty ($_GET['type'])){
		if (!empty ($_POST['original']) and !empty($_POST['now'])){
			$sql = mysql_fetch_array (mysql_query ("SELECT * FROM `user` WHERE `user`='".AnYue_User."'"));
			if ($_POST['original'] == $sql['pass']){
				//$cookietime = 1800;
				//setcookie("AnYue_User",AnYue_User,time()+$cookietime);
				//setcookie("AnYue_Pass",$_POST['now'],time()+$cookietime);
				mysql_query("UPDATE `user` SET `pass`='{$_POST['now']}' WHERE `user`='".AnYue_User."'");
				$info = '<p>恭喜您，密码修改成功，请重新登陆！</p><p><a href="index.php?act=login">登录页面>></a></p>';
			}else{
				$info = '<p>您输入的原密码有误！</p><p><a href="index.php?act=password_post">点此返回>></a></p>';
			}
		}else{
			$info = '<p>原密码或新密码不能为空！</p><p><a href="index.php?act=password_post">点此返回>></a></p>';
		}
	}else{
		$info = 'Case 1'; //载入修改页面
	}

	$AnYue_Smarty -> assign ('info',$info);
	$AnYue_Smarty -> display ('password_post.html');

