% dim rs , exec %>
注册用户资料修改 |
<%
main()
connclose()
sub main()
dim backInput, homeInput
backInput= " " homeInput=" " if request.form="" then %> <% else dim name, pass, npass1, npass2,male,face,email,qq,url,icq,msn name=Encodestr(request.form("name")) pass=Encodestr(request.form("pass")) npass1=Encodestr(request.form("npass1")) npass2=Encodestr(request.form("npass2")) male=Encodestr(request.form("male")) face=Encodestr(request.form("face")) email=Encodestr(request.form("email")) qq=Encodestr(request.form("qq")) url=Encodestr(request.form("url")) icq=Encodestr(request.form("icq")) msn=Encodestr(request.form("msn")) if not theUser.reged then response.write "发生错误 你还没有登陆,不能修改资料!" response.write backinput exit sub end if if name="" or pass="" then response.write "发生错误 请输入用户名和密码!!!" response.write backInput exit sub end if if npass1<>npass2 then response.write "发生错误 新密码和确认密码要相同!!!" response.write backInput exit sub end if pass=MD5(pass) set rs=server.createobject("adodb.recordset") if theUser.admin and theUser.name<>name then exec="select userid from [user] where username='"& replace(name,"'","") &"' and userid<>"& theUser.id rs.open exec,conn,1,1 if not rs.eof then response.write "发生错误 新用户名已经有人使用!!!" response.write backInput exit sub end if rs.close end if exec="select * from [user] where userid="&theUser.id rs.open exec,conn,1,3 if rs.eof then rsclose() response.write "发生错误 用户名不存在或密码错误!!!" response.write backInput exit sub end if if name<>theUser.name then rs("username")=name end if if npass1<>"" then pass=MD5(npass1) rs("userpassword")=pass end if if rs("sex")="1" and male="0" or rs("sex")<>"1" and male="1" then rs("sex")=male exec="update ly set male='"&male&"' where bl=1 and name='"&name&"'" conn.execute(exec) end if if rs("GBface")="" or rs("GBface")<>face then rs("GBface")=face exec="update ly set face='"&face&"' where bl=1 and name='"&name&"'" conn.execute(exec) end if if isNull(rs("useremail")) or rs("useremail")<>email then if email="" then rs("useremail")=null exec="update ly set email=null where bl=1 and name='"&name&"'" else rs("useremail")=email exec="update ly set email='"&email&"' where bl=1 and name='"&name&"'" end if conn.execute(exec) end if if isNull(rs("oicq")) or rs("oicq")<>qq then if qq="" then rs("oicq")=null exec="update ly set qq=null where bl=1 and name='"&name&"'" else rs("oicq")=qq exec="update ly set qq='"&qq&"' where bl=1 and name='"&name&"'" end if conn.execute(exec) end if if isNull(rs("homepage")) or rs("homepage")<>url then if url="" then rs("homepage")=null exec="update ly set url=null where bl=1 and name='"&name&"'" else rs("homepage")=url exec="update ly set url='"&url&"' where bl=1 and name='"&name&"'" end if conn.execute(exec) end if if isNull(rs("icq")) or rs("icq")<>icq then if icq="" then rs("icq")=null exec="update ly set icq=null where bl=1 and name='"&name&"'" else rs("icq")=icq exec="update ly set icq='"&icq&"' where bl=1 and name='"&name&"'" end if conn.execute(exec) end if if isNull(rs("msn")) or rs("msn")<>msn then if msn="" then rs("msn")=null exec="update ly set msn=null where bl=1 and name='"&name&"'" else rs("msn")=msn exec="update ly set msn='"&msn&"' where bl=1 and name='"&name&"'" end if conn.execute(exec) end if rs.update rsclose() response.write "修改成功!!!" response.write homeInput if cookiePath<>"" then response.cookies("gbook").Path=cookiePath end if response.cookies("gbook")("username")=vbescape(name) response.cookies("gbook")("password")=pass end if end sub %> |