<!--- This example is a simple login system --->
engine.asp:检验用户输入项
<%@ LANGUAGE="VBSCRIPT" %>
<%
' Connects and opens the text file
' DATA FORMAT IN TEXT FILE= "username
Set MyFileObject=Server.CreateObject
("Scripting.FileSystemObject")
Set MyTextFile=MyFileObject.OpenTextFile(Server.MapPath
("pathpathpathpath") & "passwords.txt")
' Scan the text file to determine if the user is legal
WHILE NOT MyTextFile.AtEndOfStream
' If username and password found
IF MyTextFile.ReadLine = Request.form("username") & " " &
Request.form("password") THEN
' Close the text file
MyTextFile.Close
' Go to login success page
Session("GoBack")=Request.ServerVariables
("SCRIPT_NAME")
Response.Redirect "inyougo.asp"
Response.end
END IF
WEND
' Close the text file
MyTextFile.Close
' Go to error page if login unsuccessful
Session("GoBack")=Request.ServerVariables("SCRIPT_NAME")
Response.Redirect "invalid.asp"
Response.end
%>
invalid.asp :用户无效的口令时的页面
<%@ LANGUAGE="VBSCRIPT" %>
<!--- This example is a simple login system --->
inyougo.asp:用户的口令正确
<%@ LANGUAGE="VBSCRIPT" %>
<!--- This example is a simple login system --->
passwords.txt:包含口令的文本文件
gates bill
burns joe
来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/10294527/viewspace-124661/ ,如需转载,请注明出处,否则将追究法律责任。