当前位置: 移动技术网 > IT编程>开发语言>.net > 用密码保护页面 (II)

用密码保护页面 (II)

2019年01月14日  | 移动技术网IT编程  | 我要评论
英文原文


现在我们创建查询语句,可以验证在表单中输入的内容是否与中的内容相一致。

<%@ language=vbscript %>
<% response.buffer = true %>

<html>
<body>

<% session("allow") = true %>

<%
username = request.form("username")
password = request.form("password")
grab the form contents

set myconn=server.createobject("adodb.connection")
myconn.open "your connection string here"

sql = "select * from tbllogin"
set rs = myconn.execute(sql)

if username = rs("username") and password = rs("password") then
if there is a match then show the page
%>


put the contents of your page here.

<%
else
response.redirect "https://www.yourdomain.com/login."
rs.close
myconn.close
set rs = nothing
set myconn = nothing
end if
%>
if there was no match then make the visitor try again to login.

</body>
</html>


把含上述代码的文件命名为login.asp  

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网