📄 addit.asp
字号:
<!--#include file="conn.asp"-->
<%
dim sql
dim rs
dim username
username=request("text1")
sql="select * from lm where username='" & username & "'"
set rs=conn.execute(sql)'检查用户名是否存在
if rs.eof and rs.bof then
else
response.redirect "error.asp?errorid=9"
end if
rs.close
sql="select * from admin where username='" & username & "'"
set rs=conn.execute(sql)'检查是不是管理员
if rs.eof and rs.bof then
else
response.redirect "error.asp?errorid=9"
end if
rs.close
dim password1
dim password2
dim pagename
dim url
dim currenttype
dim name
dim email
dim pic
dim note
dim i
password1=request.form("text2")
password2=request.form("text3")
pagename=request.form("text4")
url=request.form("text5")
currenttype=request.form("select")
name=request.form("text6")
email=request.form("text7")
pic=request.form("text8")
note=request.form("text9")
Function CheckID(idstr) '用户名检测函数
If idstr = "" Then
CheckID =10
Exit Function
Else
strlen = Len(idstr)
If strlen < 2 Then
CheckID = 11
Exit Function
End If
if strlen > 12 then
CheckId = 12
Exit Function
end if
For i = 1 To strlen
ch = Mid(idstr, i, 1)
If (ch >= "A" And ch <= "Z") Or (ch >= "a" And ch <= "z") Then
Else
CheckID = 13
Exit Function
End If
Next
End If
End Function
call checkid(username)
if checkid(username)<>0 then
response.redirect "error.asp?errorid=" & checkid(username)
end if
if password1<>password2 then
response.redirect "error.asp?errorid=2"
end if
if len(password1)>8 then
response.redirect "error.asp?errorid=3"
end if
if len(pagename)>8 then
response.redirect "error.asp?errorid=4"
end if
for i=1 to request.form.count
if request.form(i)="" then
response.redirect "error.asp?errorid=5"
end if
next
if len(note)>100 then
response.redirect "error.asp?errorid=14"
end if
set rs=server.createobject("adodb.recordset")
sql="select * from lm where id is null"
rs.open sql,conn,1,3
rs.addnew
rs("username")=username
rs("password")=password1
rs("url")=url
rs("pagename")=pagename
rs("name")=name
rs("email")=email
rs("pic")=pic
rs("note")=note
rs("type")=currenttype
rs("pass")=false
rs.update
set rs=nothing
response.redirect "welcome.htm"
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -