ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 口令保护(转)

口令保护(转)

原创 Linux操作系统 作者:jcszjswkzhou 时间:2019-05-17 21:21:06 0 删除 编辑
password.asp:提供一个输入界面
<%@ LANGUAGE="VBSCRIPT" %>

<!--- This example is a simple login system --->



  Password.asp


  


     User Name:
     


     Password:
     


     
  




engine.asp:检验用户输入项
<%@ LANGUAGE="VBSCRIPT" %>

<%
  ' Connects and opens the text file
  ' DATA FORMAT IN TEXT FILE= "usernamepassword"

  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 --->



invalid.asp


You have entered an invalid username or password.


Try to log in again

inyougo.asp:用户的口令正确
<%@ LANGUAGE="VBSCRIPT" %>

<!--- This example is a simple login system --->



   In You Go


   You have now entered the password protected page.

passwords.txt:包含口令的文本文件

gates bill
burns joe 


来自 “ ITPUB博客 ” ,链接:https://blog.itpub.net/10294527/viewspace-124661/ ,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2007-08-29

  • 博文量
    3481
  • 访问量
    3017966