📄 edituser.asp
字号:
<!--#include file="Connections.asp" -->
<!--#include file="top.asp" -->
<!--#include file="md5.asp" -->
<%cpbtitle="编辑个人资料"
call toptitle(l_title,cpbtitle)
call head(0,cpbusername&"的控制面板首页","userindex.asp",cpbtitle)
if isuser=false then
errormsg="<li>你还没有登陆,不能进入用户控制面板,请先<a href=login.asp>登陆</a></li>"
call error(errormsg)
call login()
else
set rsedit=server.createobject("adodb.recordset")
sqledit="select * from user where username='"&cpbusername&"'"
rsedit.open sqledit,conn,1,3
if rsedit.eof and rsedit.bof then
errormsg="<li>不存在此用户,或者用户可能已经被管理员删除</li>"
call error(errormsg)
else%>
<script language=javascript>
//定义头像
function imghead1()
{
document.form1.imgheadfy.src=document.form1.imghead.value;
document.form1.imgheadfy.width=document.form1.imgwidth.value;
document.form1.imgheadfy.height=document.form1.imgheight.value;
}
</script>
<div align="center">
<center>
<table border=1 borderColor=<%=tdc2%> cellPadding=0 cellSpacing=0 width=<%=tdc3%> style="border-collapse: collapse">
<tr>
<td class=tdc1 align="center" height="23" <%=tcolor%> width="12%">
<a href="userindex.asp" class=nav1>用户控制面板</a></td>
<td class=tdc1 align="center" height="23" <%=tcolor%> width="12%">
<a href="edituser.asp?action=editbasic" class=nav1>基本资料修改</a></td>
<td class=tdc1 align="center" height="23" <%=tcolor%> width="12%">
<a href="edituser.asp?action=editlink" class=nav1>联系资料修改</a></td>
<td class=tdc1 align="center" height="23" <%=tcolor%> width="12%">
<a href="edituser.asp?action=editpw" class=nav1>用户密码修改</a></td>
<td class=tdc1 align="center" height="23" <%=tcolor%> width="12%">
<a href="friend.asp" class=nav1>编辑好友列表</a></td>
<td class=tdc1 align="center" height="23" <%=tcolor%> width="12%">
<a href="friend.asp?action=badfriend" class=nav1>编辑忽略列表</a></td>
<td class=tdc1 align="center" height="23" <%=tcolor%> width="12%">
<a href="fav.asp" class=nav1>用户收藏管理</a></td>
<td class=tdc1 align="center" height="23" <%=tcolor%> width="12%">
<a href="pm.asp" class=nav1>用户短信服务</a></td>
</tr>
</table>
<font size="1"> </font><br> </center>
</div>
<% select case Request.QueryString("action")
case "editbasic"
editbasic()
case "editlink"
editlink()
case "editlink1"
editlink1()
case "edit"
call edit()
case "editpw"
call editpw()
case "editpw1"
call editpw1()
case "ok"
call ok()
end select
sub edit()
sex=chktopic(trim(Request.Form("sex")))
sign=chktopic(trim(Request.Form("sign")))
face=chktopic(trim(Request.Form("face")))
imghead=lcase(chktopic(trim(Request.Form("imghead"))))
imgwidth=chktopic(trim(Request.Form("imgwidth")))
imgheight=chktopic(trim(Request.Form("imgheight")))
cyear=chktopic(trim(Request.Form("cyear")))
cmonth=chktopic(trim(Request.Form("cmonth")))
cday=chktopic(trim(Request.Form("cday")))
errornum=0
if instr(imghead,"script:")>0 then
errornum=1
errormsg=errormsg&"<li>请不要在自定义头像输入非法字符:script:</li>"
end if
if imgwidth >"" then
if not IsNumeric(imgwidth) then
errornum=1
errormsg=errormsg&"<li>头像宽度必须为数字</li>"
elseif cint(imgwidth)>120 then
errornum=1
errormsg=errormsg&"<li>头像宽度必须小于120</li>"
end if
end if
if imgheight>"" then
if not IsNumeric(imgheight) then
errornum=1
errormsg=errormsg&"<li>头像高度必须为数字</li>"
elseif cint(imgheight)>120 then
errornum=1
errormsg=errormsg&"<li>头像高度必须小于120</li>"
end if
end if
if cday="" or cmonth="" or cyear="" then
h_birder=""
else
h_birder=cyear&"-"&cmonth&"-"&cday
if not isdate(h_birder) then
errornum=1
errormsg=errormsg&"<li>您的出生日期出现非法日期</li>"
end if
end if
if len(sign)>250 then
errornum=1
errormsg=errormsg&"<li>签名不能超过250个字符</li>"
end if
if errornum=1 then
call error(errormsg)
call bq()
response.end
end if
rsedit("sex")=sex
rsedit("face")=face
rsedit("imghead")=imghead
if imgwidth<>"" then
rsedit("imgwidth")=imgwidth
end if
if imgheight<>"" then
rsedit("imgheight")=imgheight
end if
rsedit("sign")=sign
if h_birder<>"" then
rsedit("h_birder")=h_birder
end if
rsedit.update
response.redirect "edituser.asp?action=ok"
end sub
sub editlink1()
qq=chktopic(trim(Request.Form("qq")))
email=chktopic(trim(Request.Form("email")))
home=chktopic(trim(Request.Form("home")))
address=chktopic(trim(Request.Form("address")))
msn=chktopic(trim(Request.Form("msn")))
openemail=trim(request.form("openemail"))
errornum=0
if email="" then
errornum=1
errormsg=errormsg&"<li>email不能为空</li>"
end if
email1=Split(email, "@")
if UBound(email1) <>1 then
errornum=1
errormsg=errormsg&"<li>email格式不对</li>"
else
email1=Split(email, ".")
if UBound(email1) <1 then
errornum=1
errormsg=errormsg&"<li>email格式不对</li>"
end if
end if
if h_checkemail=1 then
sql1="select email from user where email='"&email&"'and username<>'"&cpbusername&"'"
set rs1=conn.execute(sql1)
if not rs1.eof then
errornum=1
errormsg=errormsg&"<li>很抱歉,email重复,本论坛只允许一个email对应一个用户,请重新输入email</li>"
end if
end if
if errornum=1 then
call error(errormsg)
call bq()
response.end
end if
rsedit("email")=email
rsedit("qq")=qq
rsedit("home")=home
rsedit("face")=face
rsedit("msn")=msn
rsedit("address")=address
rsedit.update
response.redirect "edituser.asp?action=ok"
end sub
sub editpw1()
password=chktopic(trim(Request.Form("password")))
oldpassword=chktopic(trim(Request.Form("oldpassword")))
newpassword=chktopic(trim(Request.Form("newpassword")))
question=chktopic(trim(Request.Form("question")))
answer=chktopic(trim(Request.Form("answer")))
errornum=0
if oldpassword="" then
errornum=1
errormsg=errormsg&"<li>旧密码不能为空</li>"
end if
if password<>"" then
if len(password)>18 or len(password)<6 then
errornum=1
errormsg=errormsg&"<li>新密码不能超过18位或者少于6位</li>"
end if
end if
if password<>newpassword then
errornum=1
errormsg=errormsg&"<li>新密码和确认新密码必须相同</li>"
end if
if len(question)>100 then
errornum=1
errormsg=errormsg&"<li>问题不能超过100个字符</li>"
end if
if len(answer)>200 then
errornum=1
errormsg=errormsg&"<li>答案不能超过200个字符</li>"
end if
if errornum=1 then
call error(errormsg)
call bq()
response.end
end if
sql1="select email from user where username='"&cpbusername&"'and password='"&md5(oldpassword)&"'"
set rs1=conn.execute(sql1)
if rs1.eof then
errornum=1
errormsg=errormsg&"<li>很抱歉,您输入的旧密码不正确</li>"
end if
if errornum=1 then
call error(errormsg)
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -