<!--#include file=../include/config.asp-->
<!--#include file=../include/conn_view.asp-->
<!--#include file=../include/access.asp-->
<!--#include file=../include/function.asp-->

<%
	dim newpass,oldpass,confirmpass,strSql,rs
	newpass=request("newpass")	
	oldpass=request("oldpass")
	confirmpass=request("confirm")
	if oldpass="" then
		out("请输入旧密码！")
		response.write "<a href=""javascript:window.go(-1)"">返回</a>！"
		response.end
	end if

	if newpass="" then
		out("请输入新密码！")
		response.write "<a href=""javascript:window.go(-1)"">返回</a>！"
		response.end
	end if

	if confirmpass="" then
		out("请输入确认密码！")
		response.write "<a href=""javascript:window.go(-1)"">返回</a>！"
		response.end
	end if
	
'	if session("user_id")=="" then
'		out("你还没有登陆！")
'		response.write "<a href=""javascript:window.go(-1)"">返回</a>！"
'		response.end
'	end if
	
	set rs=Server.CreateObject("Adodb.RecordSet")
	'strSql="select * from [admin] where user_id=" & session("user_id")
	strSql="select * from [admin] where user_id=" & session("user_id")
	rs.Open strSql,conn,3,3

	if rs.eof then
		out("找不到该用户！")
	else
		if rs("userpassword")=oldpass then
			rs("userpassword")=newpass
			rs.update
			out("密码修改成功！<a href=""changepass.asp"">返回</a>！")
		else
			out("你输入的旧密码和密码不一样！")
		end if
	end if
	rs.close
	set rs=nothing
%>
<!--#include file=../include/foot.asp-->