<!--#include file="asp/sqlstr.asp"-->
<!--#include file="asp/opendb.asp"-->
<%
Dim username
Dim password
Dim allow
allow=0
username=request("LoginName")
password=request("Password")
if username<>"" and password<>"" then
set conn=opendb("oabusy","conn","accessdsn")
set rs=server.createobject("adodb.recordset")
sql="select * from userinf where username=" & sqlstr(username)
rs.open sql,conn,1
if (not rs.eof) then
if (trim(rs("password")))=password then
session("username")=rs("username")
response.redirect "../index.htm"
end if
else
response.redirect "../opportunities/fail1.htm"
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
end if
%>
登录验证源码如下,环境是winnt+iis4.0:
<!--#include file="asp/sqlstr.asp"-->
<!--#include file="asp/opendb.asp"-->
<%
Dim username
Dim password
Dim allow
allow=0
username=request("LoginName")
password=request("Password")
if username<>"" and password<>"" then
set conn=opendb("oabusy","conn","accessdsn")
set rs=server.createobject("adodb.recordset")
sql="select * from userinf where username=" & sqlstr(username)
rs.open sql,conn,1
if (not rs.eof) then
if (trim(rs("password")))=password then
allow=1
end if
else
allow=2
end if
rs.close
set rs=nothing
conn.close
set conn=nothing
if allow=1 then
' session("username")=username
response.redirect "../index.htm"
else
response.redirect "../opportunities/fail1.htm"
end if
end if
%>