📄 login2.asp
字号:
<%response.buffer=true%>
<!-- #include file=change.asp -->
<!-- Design and Edit By QianFengyun 2000-5-20 -->
<html>
<head>
<title><%=titlename%></title>
<%=charforhead%>
<%=styledata%>
</head>
<body>
<%
function strLength(str)
dim WINNT_CHINESE
WINNT_CHINESE=(len("例子")=2)
if WINNT_CHINESE then
dim l,t,c
dim i
l=len(str)
t=l
for i=1 to l
c=asc(mid(str,i,1))
if c<0 then c=c+65536
if c>255 then
t=t+1
end if
next
strLength=t
else
strLength=len(str)
end if
end function
user=request.form("user")
pass=request("pass")
olduser=user
user=replace(user,"'","''")
error=""
'---------验证是否输入用户名-----------
if user="" then
error=error&"<br>错误:请输入用户名!"
end if
'---------验证是否输入密码-------------
if pass="" then
error=error&"<br>错误:请输入密码!"
end if
'--------验证用户名是否太长-----------
if strLength(olduser)>10 then
error=error&"<br>错误:输入的用户名太长!"
end if
'-------验证密码是否太长-------------
if strLength(olduser)>10 then
error=error&"<br>错误:输入的密码太长!"
end if
if error<>"" then
response.write error
response.end
end if
%>
<!-- #include file=database.asp -->
<%
Set rs = Server.CreateObject("ADODB.Recordset")
sql="select * from ourusers where username='"&user&"'"
rs.open sql,conn,1,1
if not rs.eof then
if trim(rs("pass"))<>pass then
response.write "错误的密码!"
rs.close
set rs=nothing
conn.close
set conn=nothing
response.end
else
session("pass")=trim(rs("pass"))
id=rs("ID")
rs.close
set rs=nothing
conn.close
set conn=nothing
response.clear
response.redirect "manage/index1.asp?id="&id
end if
else
response.write "错误:没有找到用户!"
rs.close
end if
set rs=nothing
conn.close
set conn=nothing
%>
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -