<!--#include file="Inc.asp"-->
<!--#include file="ydzq.asp"-->

<!--#include file="forbbs.asp"-->
<!--#include file="../md5.asp"-->
<%call head()
Call saycarda("修改密码")
%>
<!--#INCLUDE file="sy1.asp"-->
<%



dim TP
dim ordpass,pass,pass1,answer
TP=Request("TP")
ordpass=trim(request("ordpass"))
pass=trim(request("pass"))
pass1=trim(request("pass1"))
answer=trim(request("answer"))

if TP<>"" then
if ordpass="" or pass="" or pass1="" then
 Call Error("各项都要填写！")
  end if
if ifbadchr("abcdefghijklmnopqrstuvwxyz0123456789",pass) > 0 or len(pass) < 6 or len(pass) > 15 then

 Call Error("新的密码必须是6至15位的英文小写字母或数字的组合！")
  end if

if pass1 <> pass then

 Call Error("重复新密码必须与新密码相同！")
  end if
set rs=server.createobject("adodb.recordset")
rs.open "select mm from Users where ID = " & myid,conn,1,2
IF rs("mm") <> "" THEN
  if ordpass <> rs("mm") then
    rs.close
    set rs=Nothing
 Call Error("旧密码不正确！")
  end if
END IF

rs("mm") = pass
rs.update
rs.close
set rs=nothing
function ubbp(str)
	str=trim(str)
	if IsNull(str) then exit function
	str=replace(str,".","")
	ubbp=str
end function
set rs=Server.CreateObject("ADODB.Recordset")
rs.open"select * from users where id="&myid,conn,1,2

sjhm=ubbp(rs("sjhm"))
rs.close
set rs=nothing
dim siddd
Function SID_RANDOMIZE()
Dim c,id
randomize 
c="a,A,1,b,B,2,c,C,3,d,D,4,e,E,5,f,F,6,g,G,7,h,H,8,i,I,9,j,J,0,k,K,1,l,L,2,m,M,3,n,N,4,o,O,5,p,P,6,q,Q,7,r,R,8,s,S,9,t,T,0,u,v,w,x,y,z,"
id=split(c,",") 
for i=1 to 10
SID_RANDOMIZE=int(rnd()*36)&SID_RANDOMIZE
Next
SID_RANDOMIZE=SID_RANDOMIZE&minute(now)&second(now)&day(now)&month(now)
End Function
siddd=md5(md5(sjhm+SID_RANDOMIZE,16),32)
set rs=Server.CreateObject("ADODB.Recordset")
rs.open"select * from users where id="&myid,conn,1,2
rs("sid")=siddd
rs("answer") = answer
rs.Update
sid=rs("sid")
rs.close
set rs=nothing
conn.close
set conn=nothing
response.write "密码已经修改为"&pass1
else
if saytk>1 then
Response.write "<form name=""form"" method=""post"" action=""passedit.asp?saytk="&saytk&"&amp;sid="&sid&""">"
 Response.Write "旧密码：<br/>"
 Response.Write "<input name=""ordpass"" maxlength=""500"" value="""&username&"""/><br/>"
 Response.Write "新密码：<br/>"
 Response.Write "<input name=""pass"" maxlength=""500"" value="""&about&"""/><br/>"
 Response.Write "确认密码：<br/>"
 Response.Write "<input name=""pass1"" maxlength=""500"" value="""&email&"""/><br/>"
end if
 Response.Write "旧密码：<br/>"
 Response.Write "<input name=""ordpass"&tt&""" maxlength=""500"" value="""&username&"""/><br/>"
 Response.Write "新密码：<br/>"
 Response.Write "<input name=""pass"&tt&""" maxlength=""500"" value="""&about&"""/><br/>"
 Response.Write "确认密码：<br/>"
 Response.Write "<input name=""pass1"&tt&""" maxlength=""500"" value="""&email&"""/><br/>"
if saytk>1 then
response.write "<input type=""hidden"" name=""TP"" value=""1""/>"

%><input type="submit" name="Submit" value="确定修改"></form><br/><%
else
 Response.Write "<anchor>确定修改"
 Response.Write "<go href=""passedit.asp?saytk="&saytk&"&amp;sid="&sid&""" method=""post"" accept-charset='utf-8'>"
 Response.Write "<postfield name=""ordpass"" value=""$(ordpass"&tt&")""/>"
 Response.Write "<postfield name=""pass"" value=""$(pass"&tt&")""/>"
 Response.Write "<postfield name=""pass1"" value=""$(pass1"&tt&")""/>"

 Response.Write "<postfield name=""TP"" value=""1""/>"
 Response.Write "</go></anchor><br/>"
 End if
 Response.Write "提示:修改密码后书签将会失效"
  end if
  response.write "<br/><a href='show.asp?saytk="&saytk&"&amp;sid="&sid&"'>我的空间</a>"
%>
<!--#include file="fanhui.asp"-->
<%Call headsay()
%>