<?
		$listuser -> checklogin($_SESSION["member"]->uid);
		
		$iserror = 0;
		$pagecontent = "";
		$tourl = "";
		
		$url = array("act" => "ok");
		$posturl = URL_user_password($url);
		
		if($act=="ok" and $iserror == 0 and $oldpassword == ""){
				$iserror = 1;
				$url = array("act" => "");
				$tourl = URL_user_password($url);
				$pagecontent = "修改失败！<br/>";
				$pagecontent .= "请输入原密码！<br/>";		
		}
		if($act=="ok" and $iserror == 0 and $newpassword == ""){
				$iserror = 1;
				$url = array("act" => "");
				$tourl = URL_user_password($url);
				$pagecontent = "修改失败！<br/>";
				$pagecontent .= "新密码不能为空！<br/>";		
		}
		if($act=="ok" and $iserror == 0 and $newpassword != $newpassword2){
				$iserror = 1;
				$url = array("act" => "");
				$tourl = URL_user_password($url);
				$pagecontent = "修改失败！<br/>";
				$pagecontent .= "您输入的两次密码不一致！<br/>";		
		}
		if($act=="ok" and $iserror == 0 and strlen($newpassword)<6){
				$iserror = 1;
				$url = array("act" => "");
				$tourl = URL_user_password($url);
				$pagecontent = "修改失败！<br/>";
				$pagecontent .= "您输入的新密码长度少于6位！<br/>";	
		}
		if($act=="ok" and $iserror == 0 and strlen($newpassword)>12){
				$iserror = 1;
				$url = array("act" => "");
				$tourl = URL_user_password($url);
				$pagecontent = "修改失败！<br/>";
				$pagecontent .= "您输入的新密码长度超过12位！<br/>";		
		}
		if($act=="ok" and $iserror == 0 and md5($oldpassword) != $listuser->getuserdate("pass",$_SESSION["member"]->uid)){
				$iserror = 1;
				$url = array("act" => "");
				$tourl = URL_user_password($url);
				$pagecontent = "修改失败！<br/>";
				$pagecontent .= "您输入的原始密码有误！<br/>";	
		}
		if($iserror == 0 and $act=="ok"){
				$db->query("UPDATE ".JIEQI_DB_PREFIX."_system_users SET pass='".md5($newpassword)."' WHERE uid=".$_SESSION["member"]->uid);
				$url = array("act" => "");
				$tourl = URL_user_password($url);
				$_Ge["member"]["pass"] = md5($newpassword);
				$pagecontent .= "修改成功！<br/>";	
		}	
		
		$smartydate = array("pagetitle" => "密码修改",
											"pagecontent" => $pagecontent,
											"tourl" => $tourl,
											"posturl" => $posturl,
											);
		if($act == "ok" or $iserror == 1){
				$smartydate["redirecturl"] = $tourl;
				$tplpath = "public.tpl";
		}else{
				$tplpath = "user/password.tpl";
		}
?>