%
dim topic,mailbody,sendmsg,SendMail,useremail
dim username,password,repassword
dim answer
stats="密码遗忘"
call nav()
call head_var(2,0,"","")
if founderr then
call dvbbs_error()
else
if request("action")="step1" then
call step1()
elseif request("action")="step2" then
call step2()
elseif request("action")="step3" then
call step3()
else
call main()
end if
if founderr then call dvbbs_error()
end if
call footer()
sub step1()
if request("username")="" then
Founderr=true
Errmsg=Errmsg+"
"+"
请输入您的用户名。"
exit sub
else
username=replace(request("username"),"'","")
end if
if Forum_Setting(2)>0 then
set rs=conn.execute("Select Quesion,Answer,Username,Usergroupid from [user] where username='"&username&"'")
else
set rs=conn.execute("Select Quesion,Answer,Username,Usergroupid from [user] where username='"&username&"' and UserGroupID>3")
end if
if rs.eof and rs.bof then
Founderr=true
errmsg=Errmsg+"
"+"您输入的用户名并不存在,请重新输入。或者由于该系统不支持邮件发送,而您的等级为版主以上级别,只能通过联系管理员获得密码。"
elseif rs(3) < 4 then
Founderr=true
errmsg=Errmsg+"
"+"您是管理员或者是版主,只能通过联系管理员获得密码。"
else
if rs(0)="" or isnull(rs(0)) then
Founderr=true
Errmsg=Errmsg+"
"+"该用户没有填写密码问题及答案,只有填写的用户方能继续。"
else
%>
<%
end if
end if
rs.close
set rs=nothing
end sub
sub step2()
dim answer
if request("username")="" then
Founderr=true
Errmsg=Errmsg+"
"+"请输入您的用户名。"
exit sub
else
username=replace(request("username"),"'","")
end if
if chkpost=false then
ErrMsg=ErrMsg+"
"+"您提交的数据不合法,请不要从外部提交发言。"
FoundErr=True
exit sub
end if
if request("answer")="" then
Founderr=true
Errmsg=Errmsg+"
"+"请输入您的问题答案。"
exit sub
else
answer=md5(request("answer"))
end if
set rs=conn.execute("select answer,quesion from [user] where username='"&username&"' and answer='"&answer&"'")
if rs.eof and rs.bof then
Founderr=true
Errmsg=Errmsg+"
"+"您输入的问题答案不正确,请重新输入。"
else
%>
<%
end if
rs.close
set rs=nothing
end sub
sub step3()
if request("username")="" then
Founderr=true
Errmsg=Errmsg+"
"+"请输入您的用户名。"
exit sub
else
username=replace(request("username"),"'","")
end if
if request("answer")="" then
Founderr=true
Errmsg=Errmsg+"
"+"请输入您的问题答案。"
exit sub
else
answer=md5(request("answer"))
end if
if request("password")="" or Len(request("password"))>10 or len(request("password"))<6 then
Founderr=true
Errmsg=Errmsg+"
"+"请输入您的新密码(长度不能大于10小于6)。"
exit sub
elseif request("repassword")="" then
Founderr=true
Errmsg=Errmsg+"
"+"请再次输入您的新密码。"
exit sub
elseif request("password")<>request("repassword") then
Founderr=true
Errmsg=Errmsg+"
"+"您输入的新密码和确认不一样,请确认您填写的信息。"
exit sub
else
password=md5(request("password"))
end if
set rs=server.createobject("adodb.recordset")
sql="select userpassword,useremail,quesion,userclass,UserGroupID from [user] where username='"&username&"' and answer='"&answer&"'"
rs.open sql,conn,1,3
if rs.eof and rs.bof then
Founderr=true
Errmsg=Errmsg+"
"+"您输入的问题答案不正确,请重新输入。"
else
if Forum_Setting(2)>0 then
repassword=request.form("password")
answer=request.form("answer")
password=rs("userpassword")
useremail=rs("useremail")
call sendusermail()
if SendMail="OK" then
sendmsg="系统已经发送一封邮件到您注册时填写的邮箱,在打开邮件中的密码激活地址后,您的新密码将正式启用。"
elseif rs("UserGroupID")<4 then
sendmsg="由于系统错误,给你发送的密码资料未成功,您的等级为版主以上级别,为了安全起见,请联系管理员获得密码。"
else
rs("userpassword")=md5(repassword)
rs.update
sendmsg="由于系统错误,给您发送的密码资料未成功。您已经修改密码成功,请使用新密码登陆系统。"
end if
else
rs("userpassword")=password
rs.update
end if
%>
<%
end if
rs.close
set rs=nothing
end sub
sub main()
%>
<%
end sub
sub sendusermail()
on error resume next
topic="您在" & Forum_info(0) & "的密码信息"
mailbody=mailbody &""
mailbody=mailbody &"
"
mailbody=mailbody & Copyright & " " & Version
select case Forum_Setting(2)
case 0
sendmsg="由于系统错误,给您发送的密码资料未成功。请点击右边的连接将您的密码激活:激活密码"
case 1
call jmail(useremail,topic,mailbody)
case 2
call Cdonts(useremail,topic,mailbody)
case 3
call aspemail(useremail,topic,mailbody)
case else
sendmsg="由于系统错误,给您发送的密码资料未成功。请点击右边的连接将您的密码激活:激活密码"
end select
end sub
%>