<!--#include file="../Include/Const.asp" -->
<!--#include file="../Include/Conn.asp" -->
<!--#Include File="Func.asp"-->
<!--#include file="../include/Md5.asp"-->
<%Response.Charset="gb2312"%>
<%
dim LoginName,LoginPassword,UserName,Password,Working,oldpassword,rs,sql
LoginName=trim(session("UserName"))
oldpassword = trim(request("txtOldPassword"))
passwordnew = trim(request("txtPassword"))
LoginPassword=Md5(oldpassword)
If oldpassword="" Then 
response.write("{""status"": 0, ""msg"": ""请输入您的旧登录密码！""}")
response.end
End If 
If passwordnew="" Then 
response.write("{""status"": 0, ""msg"": ""请输入您的新登录密码！""}")
response.end
End If 
set rs = server.createobject("adodb.recordset")
sql="select * from Angel_User where UserName='"&LoginName&"'"
rs.open sql,conn,1,3
if rs.bof and rs.eof then
response.write("{""status"": 0, ""msg"": ""温馨提示：无此用户名！""}")
response.end
else
   UserName=rs("UserName")
   Password=rs("UserPass")
   Working=rs("isEnable")
end if
if LoginPassword<>Password then
response.write("{""status"": 0, ""msg"": ""对不起，您输入的旧密码不正确！""}")
response.end
end If

if UCase(LoginName)=UCase(UserName) and LoginPassword=Password Then
	rs("UserPass")=Md5(passwordnew)
	rs("LastIP")=GetIP
	rs("LastTime")=Now()
   rs.update
   rs.close
   set rs=nothing
   session("UserName")=UserName
   session("MemLogin")="Succeed"
   session.timeout=60
   response.write("{""status"": 1, ""msg"": ""您的密码已修改成功，请记住新密码！"", ""url"": ""login.asp""}")
   response.end
end if
%>