用户登录
用户注册

分享至

怎样避免直接在地址栏敲入URL即可绕过登录页的错误?

  • 作者: 马桶污污污
  • 来源: 51数据库
  • 2020-08-08

第一个办法:用两个文件来解决这个问题:userandpwd.aspsecretarticle.asp。前者只负责提供输入用户名和密码,由后者来完成验证工作。这样即使知道了asppwdrst.asp 所在的 URL,也决不会看到什么内容的。

userandpwd.asp

< html >

< body >

< form name="form1"action=

"secretarticle.asp" method_

="POST" >

< input type="hidden" name="VTI-GROUP" value=_"0" >

< div align="center" >< center >< p >

账号< input type="text"

name="T1" size="20" >

密码< input type ="password" name="T2" size=_"20" >

< input type="submit" value="确认" name=_"B1" >

< /p >< /center >< /div >

< /form >

< /body >

< /html >

 

secretarticle.asp

' 秘密资料所在页,并负责验证账号和密码(账号:liyanbing,密码:13066093625,通过之后,才可浏览.

< html >

< % if rtrim(request.form("t1"))=

 "liyanbing” and_ rtrim(request.form("t2"))=

 "13066093625" then % >

< body >

< p align=“center” >< font face="宋体" size="7"_ color="#0000ff" >

恭喜,登录成功!

< /font >< /p >

< /body >

< % else % >

< body >

< p align="center" >< font face="宋体" size="7"_ color="#0000ff" >

请输入用户名和密码!

< /font >< /p >

< /body >

< % end if % >

< /html >

 

第二个办法:更简单一些,但实现同样的功能:

login.asp

' 登录页面

< %@ Language=VBScipt % >

< @Response.Buffer=true% >

< html >

< head >< title >撼雪喷云之欢迎登录< /title >< /head >

< body >

< %

if request("username")="liyanbing" and request("password")="13066093625" then

response.redirect "chunfeng.asp"

' 预设账号:liyanbing;密码:13066093625;资料页面:chunfeng.asp.

end if

% >

< font style="font-size:12pt" >请输入您的账号和密码"< /font >< br >

< form action="login.asp" method="post" >

< br >账号:< input type=text name="username" >

< br >密码:< input type=password name="password" >

< br >< input type=submit value="登录" >

< /form >

< /body >

< /html >

 

[1]

软件
前端设计
程序设计
Java相关