📄 includelogin.asp
字号:
<%
Response.Buffer = True
Function ValidateLogin( sId, sPwd )
' For you to validate ID and PASSWORD
' Maybe against a database
' Here we have hardcoded some OK id:s and passwords
'
ValidateLogin = False
If sId = "test" AND sPwd="secret" Then
ValidateLogin = True
End If
If sId = "user2" AND sPwd="pwd2" Then
ValidateLogin = True
End If
End Function
Dim sText, fBack
fBack = False
If Request.Form("dologin") = "yes" Then
'Try to login
If ValidateLogin( Request.Form("id"),Request.Form("pwd") ) = True Then
'It is OK!!!
'We are logged in so lets go back to the file that included us
fBack = True
Session("logonid") = Request.Form("id")
Else
sText = "Wrong password or user id"
End If
Else
'We are not trying to login...
If Session("logonid") <> "" Then
'
fBack = True
'We are logged in so lets go back to the file that included us
Else
sText = "Please login"
End If
End If
If fBack = False Then %>
<html>
<head>
<meta http-equiv="Content-Language" content="en">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>You need to login</title>
</head>
<body>
<%=sText%>
<%
Dim sIncURL
sIncURL = Request.ServerVariables("SCRIPT_NAME")
If Request.ServerVariables("QUERY_STRING") <> "" Then
'
sIncURL = sIncURL & "?" & Request.ServerVariables("QUERY_STRING")
End If
%>
<form method="POST" action="<%=sIncURL%>">
<input type="hidden" name="dologin" value="yes">
<table border="0" width="100%">
<tr>
<td>Loginname:</td>
<td><input name="id" size="20"></td>
</tr>
<tr>
<td>Password:</td>
<td><input type="password" name="pwd" size="20"></td>
</tr>
</table>
<p><input type="submit" value="Login" name="B1"></p>
</form>
</body>
</html>
<%
Response.End
End If
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -