一个ASP页面访问需要输入密码后才可以继续访问的实例
生活随笔
收集整理的這篇文章主要介紹了
一个ASP页面访问需要输入密码后才可以继续访问的实例
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
<%
'這里是用于判斷密碼輸入的
if?Request.Form("txtPass")="admin"?then
????'記錄Session
????Session("login")="admin"
end?if
%>
<%
'這里是用于清除密碼的
if?Request.QueryString("clear")<>""?then
????Session("login")=""
end?if
%>
<html>
<head>
<title>示例頁面</title>
</head>
<body>
<%
'判斷Session是否存在
if?Session("login")<>"admin"?then
%>
<!--登陸表單開始-->
<form?name="form1"?action="pass.asp"?method="post">
???請輸入密碼:<input?type="password"?name="txtPass"/>
<input?type="submit"?value="登陸"?/>
</form>
<%else%>
<!--這里是你想顯示的網頁內容-->
恭喜你,<%=Session("login")%>?!成功登陸啦!?<a?href="pass.asp?clear=yes">重新登陸</a>
<%end?if%>
</body>
</html>
'這里是用于判斷密碼輸入的
if?Request.Form("txtPass")="admin"?then
????'記錄Session
????Session("login")="admin"
end?if
%>
<%
'這里是用于清除密碼的
if?Request.QueryString("clear")<>""?then
????Session("login")=""
end?if
%>
<html>
<head>
<title>示例頁面</title>
</head>
<body>
<%
'判斷Session是否存在
if?Session("login")<>"admin"?then
%>
<!--登陸表單開始-->
<form?name="form1"?action="pass.asp"?method="post">
???請輸入密碼:<input?type="password"?name="txtPass"/>
<input?type="submit"?value="登陸"?/>
</form>
<%else%>
<!--這里是你想顯示的網頁內容-->
恭喜你,<%=Session("login")%>?!成功登陸啦!?<a?href="pass.asp?clear=yes">重新登陸</a>
<%end?if%>
</body>
</html>
轉載于:https://www.cnblogs.com/imyan/archive/2009/10/30/1592730.html
總結
以上是生活随笔為你收集整理的一个ASP页面访问需要输入密码后才可以继续访问的实例的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: VC 命名规则
- 下一篇: 删除千万级表中重复记录的办法