📄 usersave.asp
字号:
<!--#include file="conn.asp"-->
<!--#include file="function.asp"-->
<!--#include file="char.asp"-->
<%dim errmsg
founderr=false
if request("action")="" then
errmsg=errmsg+"<br>"+"<li>非法操作,请选择参数"
founderr=true
else
action=request("action")
end if
if action<>"edit" and trim(request.form("UserName"))="" or len(trim(request.form("UserName")))>20 then
errmsg=errmsg+"<br>"+"<li>用户名输入错误(未输入或长度超过了20个字节)。"
founderr=true
else
UserName=trim(request.form("UserName"))
end if
if trim(request.form("ask"))="" then
errmsg=errmsg+"<br>"+"<li>密码提示问题不能为空"
founderr=true
else
ask=trim(request.form("ask"))
end if
if trim(request.form("answer"))="" then
errmsg=errmsg+"<br>"+"<li>密码提示答案不能为空"
founderr=true
else
answer=trim(request.form("answer"))
end if
if trim(request.form("answer"))=trim(request.form("ask")) and trim(request.form("answer"))<>"" and trim(request.form("ask"))<>"" then
errmsg=errmsg+"<br>"+"<li>为了保证您资料的安全性,请不要将密码提示问题和答案填成一样!"
founderr=true
end if
if request.form("password")="" or Len(request.form("password"))>20 then
errmsg=errmsg+"<br>"+"<li>密码输入错误(未输入或长度超过了20个字节)。"
founderr=true
else
password=request.form("password")
end if
if password<>request("password2") then
errmsg=errmsg+"<br>"+"<li>您输入的密码和确认密码不一致。"
founderr=true
end if
if IsValidEmail(trim(request.form("Email")))=false then
errmsg=errmsg+"<br>"+"<li>您的Email有错误。"
founderr=true
else
Email=trim(request.form("Email"))
end if
byear=request.form("byear")
bmonth=request.form("bmonth")
bday=request.form("bday")
sex=request.form("sex")
if trim(request.form("sign"))<>"" then
sign=htmlencode(trim(request.form("sign")))
else
sign=""
end if
set rs=server.createobject("adodb.recordset")
sql="select loginip from user where lockuser=true"
rs.Open sql,conn,1,1
do while not rs.EOF
if rs("loginip")=Request.ServerVariables("REMOTE_ADDR") then
errmsg="<li>对不起,您的IP已经被管理员暂时锁定,无法注册新用户名,请和管理员联系"
call error()
Response.End
end if
rs.MoveNext
loop
rs.Close
if founderr=true then
call error()
elseif action="add" then
call add()
elseif action="edit" then
call edit()
elseif action="del" then
call del()
else
errmsg=errmsg+"<br>"+"<li>非法操作,参数错误"
call error()
response.end
end if
sub add()
sql="select * from user where username='"&username&"'"
rs.open sql,conn,1,3
if not rs.eof then
errmsg="<br>"+"<li>对不起,您输入的用户名已经被注册,请重新输入。"
founderr=true
else
rs.addnew
rs("UserName")=UserName
rs("password")=password
rs("email")=email
rs("sex")=sex
rs("ask")=ask
rs("answer")=answer
rs("face")=request.form("face")
rs("Truename")=request.form("Truename")
rs("birthday") =byear & "-" & bmonth & "-" & bday
rs("Address")=request.form("Address")
rs("oicq")=request.form("oicq")
rs("sign")=sign
if request.form("UserWebName")<>"" and request.form("UserWebUrl")<>"" then
rs("UserWebName")=request.form("UserWebName")
rs("UserWebUrl")=request.form("UserWebUrl")
end if
Rs("addDate")=NOW()
rs("login")=0
rs("score")=100
Rs("lastlogin")=NOW()
rs.update
end if
rs.close
if founderr=true then
call error()
else
%>
<!--#include file="top.asp"-->
<script>javascript:alert('<%=username%>:您好!\n\n非常感谢您的注册,本论坛还在测试阶段,请您多提宝贵建议!\n\n---------瑾以此论坛送给所有支持[黑胶碟音乐网]的朋友!')</script>
<img src="" height="3" width="1"><table cellpadding=0 cellspacing=1 border=0 width=680 bgcolor=#000000 align=center>
<TR align=middle>
<TD height=24 bgcolor="<%=tablebodycolor%>" align="center"><b>申请成功</b></TD>
</TR>
<TR>
<TD align=center bgcolor="<%=tablebodycolor%>" height="16"><br><p><p>感谢您的注册!<p>从现在开始,您可以尽情的享受我们提供的服务!</TD>
</TR>
<TR>
<TD align=center bgcolor="<%=tablebodycolor%>" height="17"><a href=UserLogin.asp><font color=#ff0000>点击这里登陆</font></a></TD>
</TR>
</TABLE>
<!--#include file="copyright.asp"-->
</body>
</html>
<%
end if
end sub
sub edit()
sql="select * from user where username='"&Request.Cookies("bookbaby")("username")&"' and password='"&Request.Cookies("bookbaby")("userpwd")&"'"
rs.open sql,conn,1,3
if rs.eof then
errmsg="<br>"+"<li>对不起,你不是本站用户,请重新注册。"
founderr=true
else
rs("password")=password
rs("email")=email
rs("sex")=sex
rs("ask")=ask
rs("answer")=answer
rs("face")=request.form("face")
rs("Truename")=request.form("Truename")
rs("birthday")=byear & "-" & bmonth & "-" & bday
rs("Address")=request.form("Address")
rs("oicq")=request.form("oicq")
rs("sign")=sign
if request.form("UserWebName")<>"" and request.form("UserWebUrl")<>"" then
rs("UserWebName")=request.form("UserWebName")
rs("UserWebUrl")=request.form("UserWebUrl")
end if
id=rs("id")
rs.update
Response.Cookies("bookbaby")("userpwd")=password
end if
rs.close
if founderr=true then
call error()
else
%>
<!--#include file="top.asp"-->
<meta http-equiv="refresh" content="5;URL=userinf.asp?id=<%=id%>">
<table cellpadding=0 cellspacing=1 border=0 width=680 bgcolor=#000000 align=center>
<TR align=middle>
<TD height=24 bgcolor="<%=tablebodycolor%>"><b>资料修改成功</b></TD>
</TR>
<TR>
<TD align=center bgcolor="<%=tablebodycolor%>" height="15">您的资料已经成功修改,请继续浏览!</TD>
</TR>
<TR>
<TD align=center bgcolor="<%=tablebodycolor%>" height="18"><a href=userinf.asp?id=<%=id%>>点击这里查看修改后的个人信息</a></TD>
</TR>
</TABLE>
<!--#include file="copyright.asp"-->
</body>
</html>
<%
end if
end sub
set rs=nothing
conn.close
set conn=nothing
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -