⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 index.asp

📁 web课件并附有习题练习还有实例详细的讲解了WEB的各种开发过程是学习 的好资料
💻 ASP
字号:
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/conn.asp" -->
<%
' *** Validate request to log in to this site.
MM_LoginAction = Request.ServerVariables("URL")
If Request.QueryString<>"" Then MM_LoginAction = MM_LoginAction + "?" + Server.HTMLEncode(Request.QueryString)
MM_valUsername=CStr(Request.Form("txtname"))
MM_valUsername=CStr(Request.QueryString("txtname"))

If MM_valUsername <> "" Then
  MM_fldUserAuthorization=""
  MM_redirectLoginSuccess="su.asp"
  MM_redirectLoginFailed="index.asp"
  MM_flag="ADODB.Recordset"
  set MM_rsUser = Server.CreateObject(MM_flag)
  MM_rsUser.ActiveConnection = MM_conn_STRING
  MM_rsUser.Source = "SELECT name, pwd"
  If MM_fldUserAuthorization <> "" Then MM_rsUser.Source = MM_rsUser.Source & "," & MM_fldUserAuthorization
  'MM_rsUser.Source = MM_rsUser.Source & " FROM user WHERE name='" & Replace(MM_valUsername,"'","''") &"' AND pwd='" & Replace(Request.Form("txtpwd"),"'","''") & "'"
    MM_rsUser.Source = MM_rsUser.Source & " FROM user WHERE name='" & Replace(MM_valUsername,"'","''") &"' AND pwd='" & Replace(request.QueryString("txtpwd"),"'","''") & "'"

  MM_rsUser.CursorType = 0
  MM_rsUser.CursorLocation = 2
  MM_rsUser.LockType = 3
  MM_rsUser.Open
  If Not MM_rsUser.EOF Or Not MM_rsUser.BOF Then 
    ' username and password match - this is a valid user
    Session("MM_Username") = MM_valUsername
    If (MM_fldUserAuthorization <> "") Then
      Session("MM_UserAuthorization") = CStr(MM_rsUser.Fields.Item(MM_fldUserAuthorization).Value)
    Else
      Session("MM_UserAuthorization") = ""
    End If
    if CStr(Request.QueryString("accessdenied")) <> "" And false Then
      MM_redirectLoginSuccess = Request.QueryString("accessdenied")
    End If
    MM_rsUser.Close
    Response.Redirect(MM_redirectLoginSuccess)
  End If
  MM_rsUser.Close
  Response.Redirect(MM_redirectLoginFailed)
End If
%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>test</title>
<style type="text/css">
<!--
.style2 {font-size: 36px}
-->
</style>
</head>

<body>
<form name="form1" method="get" action="<%=MM_LoginAction%>">
  <table width="256" border="0" align="center">
    <tr>
      <td colspan="3"><div align="center"><span class="style2">登录</span></div></td>
    </tr>
    <tr>
      <td width="8" rowspan="3">&nbsp;</td>
      <td width="58">用户名:</td>
      <td width="112"><input name="txtname" type="text" id="txtname"></td>
    </tr>
    <tr>
      <td>密码:</td>
      <td><input name="txtpwd" type="password" id="txtpwd"></td>
    </tr>
    <tr>
      <td>&nbsp;</td>
      <td>      <div align="center">
        <input name="btnreset" type="reset" id="btnreset" value="重置">
        <input name="btsub" type="submit" id="btsub" value="提交">
      </div></td>
    </tr>
  </table>
  <p >&nbsp;</p>
</form>
</body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -