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

📄 t_index.asp

📁 学籍管理功能,能实现调班注销学籍等,中小学通用
💻 ASP
字号:
<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/conn.asp" -->
<%
' *** Edit Operations: declare variables

Dim MM_editAction
Dim MM_abortEdit
Dim MM_editQuery
Dim MM_editCmd

Dim MM_editConnection
Dim MM_editTable
Dim MM_editRedirectUrl
Dim MM_editColumn
Dim MM_recordId

Dim MM_fieldsStr
Dim MM_columnsStr
Dim MM_fields
Dim MM_columns
Dim MM_typeArray
Dim MM_formVal
Dim MM_delim
Dim MM_altVal
Dim MM_emptyVal
Dim MM_i

MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
If (Request.QueryString <> "") Then
  MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
End If

' boolean to abort record edit
MM_abortEdit = false

' query string to execute
MM_editQuery = ""
%>
<%
' *** Insert Record: set variables

If (CStr(Request("MM_insert")) = "form2") Then

  MM_editConnection = MM_conn_STRING
  MM_editTable = "caozuojilu"
  MM_editRedirectUrl = ""
  MM_fieldsStr  = "jilu|value|username|value|IP|value"
  MM_columnsStr = "jilu|',none,''|username|',none,''|IP|',none,''"

  ' create the MM_fields and MM_columns arrays
  MM_fields = Split(MM_fieldsStr, "|")
  MM_columns = Split(MM_columnsStr, "|")
  
  ' set the form values
  For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
    MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
  Next

  ' append the query string to the redirect URL
  If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
    If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And Request.QueryString <> "") Then
      MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
    Else
      MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
    End If
  End If

End If
%>
<%
' *** Insert Record: construct a sql insert statement and execute it

Dim MM_tableValues
Dim MM_dbValues

If (CStr(Request("MM_insert")) <> "") Then

  ' create the sql insert statement
  MM_tableValues = ""
  MM_dbValues = ""
  For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
    MM_formVal = MM_fields(MM_i+1)
    MM_typeArray = Split(MM_columns(MM_i+1),",")
    MM_delim = MM_typeArray(0)
    If (MM_delim = "none") Then MM_delim = ""
    MM_altVal = MM_typeArray(1)
    If (MM_altVal = "none") Then MM_altVal = ""
    MM_emptyVal = MM_typeArray(2)
    If (MM_emptyVal = "none") Then MM_emptyVal = ""
    If (MM_formVal = "") Then
      MM_formVal = MM_emptyVal
    Else
      If (MM_altVal <> "") Then
        MM_formVal = MM_altVal
      ElseIf (MM_delim = "'") Then  ' escape quotes
        MM_formVal = "'" & Replace(MM_formVal,"'","''") & "'"
      Else
        MM_formVal = MM_delim + MM_formVal + MM_delim
      End If
    End If
    If (MM_i <> LBound(MM_fields)) Then
      MM_tableValues = MM_tableValues & ","
      MM_dbValues = MM_dbValues & ","
    End If
    MM_tableValues = MM_tableValues & MM_columns(MM_i)
    MM_dbValues = MM_dbValues & MM_formVal
  Next
  MM_editQuery = "insert into " & MM_editTable & " (" & MM_tableValues & ") values (" & MM_dbValues & ")"

  If (Not MM_abortEdit) Then
    ' execute the insert
    Set MM_editCmd = Server.CreateObject("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_editConnection
    MM_editCmd.CommandText = MM_editQuery
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close

    If (MM_editRedirectUrl <> "") Then
      Response.Redirect(MM_editRedirectUrl)
    End If
  End If

End If
%>
<%
Dim Recordset1
Dim Recordset1_numRows

Set Recordset1 = Server.CreateObject("ADODB.Recordset")
Recordset1.ActiveConnection = MM_conn_STRING
Recordset1.Source = "SELECT * FROM admin_name ORDER BY ID ASC"
Recordset1.CursorType = 0
Recordset1.CursorLocation = 2
Recordset1.LockType = 1
Recordset1.Open()

Recordset1_numRows = 0
%>
<%
' *** 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("class"))
If MM_valUsername <> "" Then
  MM_fldUserAuthorization=""
  MM_redirectLoginSuccess="main.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 class, power"
  If MM_fldUserAuthorization <> "" Then MM_rsUser.Source = MM_rsUser.Source & "," & MM_fldUserAuthorization
  MM_rsUser.Source = MM_rsUser.Source & " FROM admin_name WHERE class='" & Replace(MM_valUsername,"'","''") &"' AND power='" & Replace(Request.Form("power"),"'","''") & "'"
  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 true 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 XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>培英学校新生学籍录入系统</title>
<style type="text/css">
<!--
.STYLE1 {
	color: #006633;
	font-size: 18px;
	font-weight: bold;
}
.STYLE2 {
	font-size: 12px;
	color: #006633;
}
.STYLE3 {color: #006633}
.STYLE4 {font-size: 24px}
body {
	background-color: #CCCCCC;
}
-->
</style>
<% 
'****************************** 
'函数:Userip() 
'参数:无 
'作者:阿里西西 
'日期:2007/7/12 
'描述:取得客户端IP地址 
'示例:<%=Userip() 
'****************************** 
Function Userip() 
Dim GetClientIP 
'如果客户端用了代理服务器,则应该用ServerVariables("HTTP_X_FORWARDED_FOR")方法 
GetClientIP = Request.ServerVariables("HTTP_X_FORWARDED_FOR") 
If GetClientIP = "" or isnull(GetClientIP) or isempty(GetClientIP) Then 
'如果客户端没用代理,应该用Request.ServerVariables("REMOTE_ADDR")方法 
GetClientIP = Request.ServerVariables("REMOTE_ADDR") 
end if 
Userip = GetClientIP 
End function 
%> 
<script LANGUAGE="vbscript"> 
<!-- 
Sub form1_onsubmit() //** 这里是关键,当form1在提交的过程中时,激活form2的提交 
form2.submit() //** 所以我们这里用了两个表单,但只需点击一次提交就可以了。 
End Sub 
--> 
</script>
<script language="VBScript" type="text/vbscript">
<!--
function aa()

		form2.username.value=form1.class.value

End function
-->
</script>
</head>

<body>

<div align="center" class="STYLE1 STYLE4">
  <p> </p>
  <p>&nbsp;</p>
</div>
<form id="form1" name="form1" method="POST" action="<%=MM_LoginAction%>">
  <label>
  <div align="center"><br />
    
      <table cellspacing="0" cellpadding="0" width="485" border="0">
        <tbody>
          <tr>
            <td><img height="75" src="images/top.gif" 
        width="485" /></td>
          </tr>
          <tr>
            <td background="images/middle_bbg.gif"><table height="230" cellspacing="0" cellpadding="0" width="470" align="center" 
            background="images/middle_bg.gif" border="0">
                <tbody>
                  <tr>
                    <td valign="center" align="middle"><table cellspacing="2" cellpadding="2" width="474" border="0">
                        <tbody>
                          <tr>
                            <td width="466" height="41" class="font12B">&nbsp;</td>
                          </tr>
                          
                          <tr>
                            <td class="font12" height="32">
                            用 户 名:<span class="STYLE2">
                            <select name="class" size="1" id="class" class="STYLE2"   onchange="aa()">
                              <option value="" selected="selected" <%If (Not isNull((Recordset1.Fields.Item("class").Value))) Then If ("" = CStr((Recordset1.Fields.Item("class").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%>>选择班级</option>
                              <%
While (NOT Recordset1.EOF)
%>
                              <option value="<%=(Recordset1.Fields.Item("class").Value)%>" <%If (Not isNull((Recordset1.Fields.Item("class").Value))) Then If (CStr(Recordset1.Fields.Item("class").Value) = CStr((Recordset1.Fields.Item("class").Value))) Then Response.Write("selected=""selected""") : Response.Write("")%> ><%=(Recordset1.Fields.Item("class_1").Value)%></option>
                              <%
  Recordset1.MoveNext()
Wend
If (Recordset1.CursorType > 0) Then
  Recordset1.MoveFirst
Else
  Recordset1.Requery
End If
%>
                            </select>
                            </span></td>
                          </tr>
                          <tr>
                            <td class="font12" height="17"><label for="saveName"></label></td>
                          </tr>
                          <tr>
                            <td class="font12" height="32">用户密码:<span class="STYLE2">
                              <input name="power" type="password" id="power" size="10"  class="STYLE2"/>
                            </span> </td>
                          </tr>
                          <tr>
                            <td height="32">&nbsp;</td>
                          </tr>
                          <tr>
                            <td height="30"><span class="STYLE2">
                              <input type="submit" name="Submit" value="登录学籍修改" />
                            </span></td>
                          </tr>
                          <tr>
                            <td align="middle">&nbsp;</td>
                          </tr>
                        </tbody>
                    </table></td>
                  </tr>
                </tbody>
            </table></td>
          </tr>
          <tr>
            <td><img height="24" src="images/bottom.gif" 
          width="485" /></td>
          </tr>
        </tbody>
      </table>
      </div>
  </label>
  <span class="STYLE2">
  <label></label>
  </span><span class="STYLE3">
  <label> </label>
  </span>
  <label></label>
</form>
<form id="form2" name="form2" method="POST" action="<%=MM_editAction%>">
  <input name="jilu" type="hidden" id="jilu" value="准备登录教师学籍管理" />
  <input name="username" type="hidden" id="username" />
  <input name="IP" type="hidden" id="IP" value="<% = Userip() %>" />
  <input type="hidden" name="MM_insert" value="form2">
</form>
</body>
</html>
<%
Recordset1.Close()
Set Recordset1 = Nothing
%>

⌨️ 快捷键说明

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