1. <tt id="5hhch"><source id="5hhch"></source></tt>
    1. <xmp id="5hhch"></xmp>

  2. <xmp id="5hhch"><rt id="5hhch"></rt></xmp>

    <rp id="5hhch"></rp>
        <dfn id="5hhch"></dfn>

      1. ASP在線教育系統(tǒng)(一)

        時間:2022-12-26 11:39:13 計算機畢業(yè)論文 我要投稿
        • 相關(guān)推薦

        ASP在線教育系統(tǒng)(一)

        目   錄
        前言 3
        第一章 編程環(huán)境基礎(chǔ)知識 4
        1.1 ASP技術(shù)簡介 4
        1.2 ACCESS2003 技術(shù)簡介 4
        第二章 需求分析 1
        2.1   目標設(shè)計 1
        2.2   系統(tǒng)功能分析與設(shè)計 2
        2.3   性能需求 2
        第三章 系統(tǒng)設(shè)計 4
        3.1  資料顯示模塊 4
        3.1.1 資料信息顯示頁 5
        3.1.2 資料詳細信息頁 9
        3.1.3 資料信息下載頁 11
        3.1.4 提交回復作業(yè)頁 12
        3.1.5 提交回復作業(yè)成功頁 13
        3.1.6 教師基本信息頁 16
        3.1.7 資料信息搜索頁 20
        3.1.8 資料信息搜索結(jié)果頁 21
        3.2  資料管理模塊 22
        3.2.1 管理員登陸頁 24
        3.2.2 驗證管理員帳號頁 24
        3.2.3 管理員登陸成功頁 26
        3.2.4 增加資料欄目頁 27
        3.2.5 增加欄目成功頁 28
        3.2.6 修改欄目信息頁 30
        3.2.7 保存修改的欄目信息頁 32
        3.2.8 刪除欄目信息頁 34
        3.2.9 刪除欄目信息成功頁 34
        3.2.10 發(fā)布資料信息頁 36
        3.2.11 資料信息發(fā)布成功頁 38
        3.2.12 資料信息列表頁 39
        3.2.13 資料信息修改頁 39
        3.2.14 保存修改的資料信息頁 42
        3.2.15 刪除資料信息頁 46
        3.2.16 刪除資料信息成功頁 47
        3.3  教師管理 50
        3.3.1 搜索教師頁 51
        3.3.2 教師搜索結(jié)果頁 52
        3.3.3 添加教師信息頁 53
        3.3.4 添加教師成功頁 54
        3.3.5 修改教師信息頁 55
        3.3.6 修改教師信息成功頁 57
        3.3.7 刪除教師信息頁 58
        3.3.8 刪除教師信息成功頁 58
        第四章 數(shù)據(jù)庫結(jié)構(gòu)設(shè)計 60
        4.1 數(shù)據(jù)庫需求分析 60
        4.2 數(shù)據(jù)庫邏輯設(shè)計 60
        4.3 數(shù)據(jù)庫連接說明 61
        第五章 測試和維護 62
        5.1 網(wǎng)站維護 62
        5.2 網(wǎng)站測試 62
        參考文獻 63
        致謝 64

        ASP在線教育系統(tǒng)(一)

        前言
         與傳統(tǒng)教育相比,遠程教育是一種全新的教育模式,它可以突破時間和空間的限制,幫助人們隨時隨地地學習,讓更多的學習者共享優(yōu)秀教育資源。遠程教育既具有開放性、交互性、協(xié)作性和自主性等特點,又具有異步性、實時性、生動性、集成性和大容量等優(yōu)勢。因此,在遠程教育系統(tǒng)的建設(shè)中,單純地構(gòu)建各種功能單一的系統(tǒng)并不能完全滿足遠程教育建設(shè)的需求,只有那些對數(shù)據(jù)和信息進行了有效組織、整合了多種業(yè)務(wù)、為用戶提供個性化服務(wù)的系統(tǒng)才能充分發(fā)揮遠程教育的作用。
         使用在線教育系統(tǒng)可以為用戶提供在線教案學習、在線提交作業(yè)和查詢教師等服務(wù)。
        第一章 編程環(huán)境基礎(chǔ)知識
        1.1 ASP技術(shù)簡介
         Microsoft Active Server Pages 即我們所稱的ASP,其實是一套微軟開發(fā)的服務(wù)器端腳本環(huán)境.Active Server Page 是創(chuàng)建動態(tài)網(wǎng)頁的一個很好的工具,它起一種編程語言的作用,可以利用它編寫動態(tài)產(chǎn)生HTML的程序代碼.因此,只要用戶瀏覽Web站點并請求一個ASP頁,Web服務(wù)器就可以處理相應(yīng)的ASP代碼,生成HTML代碼,然后將它傳遞到用戶瀏覽器并顯示出網(wǎng)頁.
         ASP程序的優(yōu)點:
         1,ASP使用VBScript腳本語言直接源于VB語言,秉承了VB簡單易學的特點,掌管起來非常容易.
         2,無須編譯,容易編寫,可在服務(wù)器端直接執(zhí)行.
         3,利用ADO組件輕松存取數(shù)據(jù)庫.
         4,與瀏覽器無關(guān),客戶端只要使用可執(zhí)行HTML碼的瀏覽器,即可瀏覽ASP所設(shè)計的網(wǎng)頁內(nèi)容.
         5,ASP能與任何ActiveX scripting語言相容.除了可使用VBScript或java script語言來設(shè)計外,還通過plug-in的方式,使用由第三方所提供的其他腳本語言.
         6,ASP技術(shù)的處理速度相當快,并且其安全性也很高,ASP的源程序,不會被傳到客戶瀏覽器,因而可以避免所寫的源程序被他人剽竊,也提高了程序的安全性.
         7,ASP的對象和組件:ASP有7個固有對象這7個固有對象分別是Request,Response,Server,Application,Session,ASPError和ObjectContext.
        1.2 ACCESS2003 技術(shù)簡介
         Access2003 就是關(guān)系數(shù)據(jù)庫開發(fā)工具,數(shù)據(jù)庫能匯集各種信息以供查詢,存儲和檢索.那么什么叫數(shù)據(jù)庫呢 數(shù)據(jù)庫(Database)是由一些有意義和有關(guān)系的數(shù)據(jù)(data)所組合而成.一個數(shù)據(jù)庫中,包含了許多條記錄(Record),而每條記錄是由多個字段(Field)所組成,不同的字段存放這不同的數(shù)據(jù).所以數(shù)據(jù)庫的嚴格定義是一組相關(guān)記錄的集合,而字段則是最基本的數(shù)據(jù)項,也是數(shù)據(jù)庫中最小的單位.在計算機中用來幫我們管理數(shù)據(jù)庫的系統(tǒng),我們稱之為數(shù)據(jù)庫管理管理系統(tǒng)(Database Management System DBMS).數(shù)據(jù)庫管理系統(tǒng)是架構(gòu)在一個或多個數(shù)據(jù)庫之上,并針對數(shù)據(jù)庫中的數(shù)據(jù)進行管理運用.
         Access 的優(yōu)點在于它能使用數(shù)據(jù)表示圖或自定義窗體收集信息,數(shù)據(jù)表示圖提供了一種類似于 Excel 的電子表格,可以使數(shù)據(jù)庫一目了然.另外,Access 允許創(chuàng)建自定義報表用于打印或輸出數(shù)據(jù)庫中的信息.Access也提供了數(shù)據(jù)存儲庫,可以使用桌面數(shù)據(jù)庫文件把數(shù)據(jù)庫文件置于網(wǎng)絡(luò)文件服務(wù)器,與其他網(wǎng)絡(luò)用戶共享數(shù)據(jù)庫.如上所述,Access 作為關(guān)系數(shù)據(jù)庫開發(fā)具備了許多優(yōu)點,可以在一個數(shù)據(jù)包中同時擁有桌面數(shù)據(jù)庫的便利和關(guān)系數(shù)據(jù)庫的強大功能.
         
        第二章 需求分析
         一個典型的在線教育系統(tǒng)至少應(yīng)包含資料顯示、資料管理和教師管理3種功
         
        能。本站的系統(tǒng)結(jié)構(gòu)如圖2—1所示。
         
         2-1系統(tǒng)結(jié)構(gòu)
         
        2.1   目標設(shè)計
             在線教育系統(tǒng)所要實現(xiàn)的功能如下。
             ●  資料顯示模塊
                 ■  顯示資料
                 ■  顯示教師介紹
                 ■  瀏覽查閱資料
                 ■  回復提交資料
         ●  資料管理模塊
                 ■  資料欄目管理
                 ■  發(fā)布資料
                 ■  管理資料
             ●  教師管理模塊
                 ■  添加教師信息
                 ■  編輯教師信息
                 ■  刪除教師信息
        2.2   系統(tǒng)功能分析與設(shè)計
           在線教育系統(tǒng)共分為3個模塊:資料顯示模塊、資料管理模塊和教師管理模塊,其功能模塊劃分如圖所示。
         
         
        2.3   性能需求
           開發(fā)環(huán)境
        WindowsXP操作系統(tǒng)
        80G的硬盤空間
        AMD2500+處理器
        17 # 純平監(jiān)視器
        512內(nèi)存
         適用環(huán)境
         1.Windows98/Me/2000/XP操作系統(tǒng)
         2.1G以上的硬盤空間
         3.Inter 賽揚1.0G以上處理器
         4.15 # 普通監(jiān)視器以上
         5.32M以上內(nèi)存
        第三章 系統(tǒng)設(shè)計
        3.1  資料顯示模塊
         資料顯示模塊包含以下子模塊。
         ●  資料顯示
         ●  資料搜索
         資料顯示子模塊包含以下頁面。
         ●  index.asp
         ●  detail.asp
         ●  download.asp
         ●  teacherinfo.asp
         資料搜索子模塊包含以下頁面。
         ●  search.asp
         ●  list.asp
         各頁面間的關(guān)系如圖3-1所示。
              
         
         3-1各頁面間的關(guān)系
          
           3.1.1 資料信息顯示頁
         1. index.asp頁面示例
         圖3-2為顯示資料信息所看到的頁面。
         
         
         
         圖 3-2  顯示資料信息
         2. 頁面中需要用戶填寫的HTML表單元素。
         此頁無需填寫HTML表單元素。
         3. 頁面所涉及的數(shù)據(jù)庫表信息。
        此頁面用來顯示資料信息,使用了系統(tǒng)中的資料信息表main和教師信息表teacher。
         4. 頁面代碼分析
           ‘引用創(chuàng)建數(shù)據(jù)庫連接對象函數(shù)文件
         <!--#include file="conn.asp"-->
         ‘引用網(wǎng)站設(shè)置文件 
         <!--#include file="fenlei.asp"-->
         <%’取得網(wǎng)站設(shè)置信息
         sql = "select * from config"
         set rs = server.createobject("adodb.recordset")
         rs.open sql,conn,1,3
         schoolname = rs("schoolname")
         gonggao = rs("gonggao")
         todaytimes = rs("todaytimes")
         times = rs("times")
         ‘今日訪問統(tǒng)計
         if rs("todaydate") <> date() then
         rs("todaydate") = date()
         rs.update
         todaytimes = 0
         end if
         ‘總訪問統(tǒng)計
         if request.cookies("counted") <> "yes" then
         response.cookies("counted") = "yes"
         ‘設(shè)置cookies失效時間
         response.cookies("counted").expires = now() + 1/72
         ‘統(tǒng)計數(shù)加1
         times = times + 1
         todaytimes = todaytimes + 1
         rs("times") = times
         rs("todaytimes") = todaytimes
         rs.update
         end if
         ‘關(guān)閉記錄集對象
         rs.close
         dim num1
         dim rndnum
         Randomize
         %>
         ‘Html頁面顯示部分
         ……
         <%’取最近更新的10條資料記錄
         sql = "select * from main,teacher where main.idofteacher=teacher.teacherid order by main.times desc"
         rs.open sql,conn,1,1
         ‘顯示最近更新的10條資料記錄
         for i = 1 to 10
         if rs.eof then
         response.write "<tr><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td><td>&nbsp;</td></tr>"
         else
         if len(rs("title")) > 10 then
         filetitle = left(rs("title"),10)&"..."
         else
         filetitle = rs("title")
         end if
         %>
         <tr><td align=left>&nbsp;<img src=images/arrow.gif>
         <a href=# title="<%=rs("title")%>" onclick=java script:showdetail(<%=rs("mainid")%>);><%=filetitle%></a>
         </td><td align=center><a href=teacherinfo.asp?id=<%=rs("teacherid")%> title="查看<%=rs("teacher")%>的個人專集"><%=rs("teacher")%></a></td>
         <td align=center><%=rs("times")%></td>
         <td align=left>&nbsp;&nbsp;<%=rs("fenlei2")%></td></tr>
         <%‘取下一條資料記錄
         rs.movenext
         end if
         next
         ‘關(guān)閉記錄集對象
         rs.close
         %>
        3.1.2 資料詳細信息頁
          1. etail.asp頁面示例
          圖3-3為顯示資料詳細信息的頁面。

        圖3-3  資料詳細信息
          2. 頁面中需要用戶填寫的Html表單元素。
          此頁無需填寫Html表單元素。
          3. 面所涉及的數(shù)據(jù)庫表信息。
          此頁使用了系統(tǒng)中的資料信息表main和教師信息表teacher。
          4. 頁面代碼分析
          ‘引用創(chuàng)建數(shù)據(jù)庫連接對象函數(shù)文件
         <!--#include file="conn.asp"-->
         ‘引用網(wǎng)站設(shè)置文件
         <!--#include file="fenlei.asp"-->
         <%’取得要顯示資料信息的id號
         id = request("id")
         if id = "" then
          conn.close
          set conn = nothing
          response.write "<script>alert('沒有找到您要查看的記錄');window.close();</script>"
          response.end
         end if
         ‘打開記錄集對象
         set rs = server.createobject("adodb.recordset")
         sql = "select * from main,teacher,type where main.idofteacher=teacher.teacherid and main.idoftype=type.typeid and main.mainid="&id
         ‘取得資料詳細信息
         rs.open sql,conn,1,1
         ‘如果資料詳細信息不存在則提示錯誤
         if rs.bof and rs.eof then
          rs.close
          set rs = nothing
          conn.close
          set conn = nothing
          response.write "<script>alert('沒有找到您要查看的記錄');window.close();</script>"
          response.end
         else
         %>
         ‘Html頁面顯示部分,顯示資料的詳細信息
         ……
         <%’關(guān)閉記錄集對象
         rs.close
         set rs = nothing
         ‘關(guān)閉數(shù)據(jù)庫連接對象
         conn.close
         set conn = nothing
         end if
        3.1.3 資料信息下載頁
          1. download.asp頁面示例
          圖3-4 為閱讀資料信息所看到的頁面。

        圖3-4  閱讀資料信息
          2. 頁面中需要用戶填寫的Html表單元素
          此頁無需填寫Html表單元素。
          3. 頁面所涉及的數(shù)據(jù)庫表信息
          此頁使用了系統(tǒng)中的資料信息表main。
          4. 頁面代碼分析
         <%’取得要顯示資料信息的id號
         id = trim(request("id"))
         if id = "" then
          conn.close
          set conn = nothing
          response.write "<script>alert('沒有找到您要閱讀的資料');window.close();</script>"
          response.end
         end if
         sql = "select * from main where mainid="&id
         set rs = server.createobject("adodb.recordset")
         ‘取得資料詳細信息
         rs.open sql,conn,1,3
         ‘如果資料詳細信息不存在則提示錯誤
         if rs.bof and rs.eof then
          rs.close
          set rs = nothing
          conn.close
          set conn = nothing
          response.write "<script>alert('沒有找到您要閱讀的資料');window.close();</script>"
          response.end
         ‘如果資料詳細信息存在
         Else
         ‘該資料閱讀數(shù)加1
          rs("times") = rs("times") + 1
          rs.update
         ‘頁面下載或者打開資料信息
          response.redirect rs("fileurl")
         ‘關(guān)閉記錄集對象
          rs.close
          set rs = nothing
         ‘關(guān)閉數(shù)據(jù)庫連接對象
          conn.close
          set conn = nothing
         end if
         %>
        3.1.4 提交回復作業(yè)頁
          1. redetail.asp頁面示例
          圖3-5為提交回復作業(yè)信息所看到的頁面。

        圖3-5  提交回復作業(yè)信息
          2. 頁面中需要用戶填寫的Html表單元素
          此頁中有3個表單元素,如表1所示。
          表1                 redetail.asp頁的表單元素
         名稱  表單元素類型  含義 最大長度
        Name Text 學生姓名 20
        Title Text 作業(yè)標題 20
        Message Textarea 作業(yè)答案 100
          3. 頁面所涉及的數(shù)據(jù)庫表信息
          此頁面用來顯示提交回復作業(yè)信息,并沒有涉及到數(shù)據(jù)庫表的操作。
          4. 頁面代碼分析
         ‘Html頁面表單提交到redetailok.asp提交作業(yè)答案
         <form action="redetailok.asp" method="post" >
         ‘Html頁面顯示部分
         ……
         </form>
        3.1.5 提交回復作業(yè)成功頁
          1. 頁面中需要用戶填寫的Html表單元素
          此頁無需填寫Html表單元素。
          2. 頁面所涉及的數(shù)據(jù)庫表信息
          此頁使用了系統(tǒng)中的回復作業(yè)信息記錄表work。
          3. 頁面代碼分析
         ‘引用創(chuàng)建數(shù)據(jù)庫連接對象函數(shù)文件
         <!--#include file="conn.asp"-->
         <%’學生姓名必須要輸入
         name = trim(request("name"))
         if name = "" then
          response.write "<script>alert('請輸入學生姓名');history.go(-1);</script>"
          conn.close
          set conn = nothing
          response.end
         end if
         if len(name) > 5 then
          response.write "<script>alert('學生姓名不得超過5個漢字');history.go(-1);</script>"
          conn.close
          set conn = nothing
          response.end
         end if
         ‘作業(yè)標題必須要輸入
         title = trim(request("title"))
         if title = "" then
          response.write "<script>alert('請輸入作業(yè)標題');history.go(-1);</script>"
          conn.close
          set conn = nothing
          response.end
         end if
         ‘作業(yè)答案必須要輸入
         message = trim(request("message"))
         if message = "" then
          response.write "<script>alert('請輸入作業(yè)答案');history.go(-1);</script>"
          conn.close
          set conn = nothing
          response.end
         end if
         ‘作業(yè)的id號必須存在
         reid = trim(request("reid"))
         if reid = "" then
          response.write "<script>alert('非法操作');history.go(-1);</script>"
          conn.close
          set conn = nothing
          response.end
         end if
         
         sql = "select * from work where name='"&name&"' and reid="&reid
         set rs = server.createobject("adodb.recordset")
         ‘查找作業(yè)表中是否存在學生姓名和回復作業(yè)的id號相同的記錄存在
         rs.open sql,conn,1,3
         ‘如果存在則說明學生已經(jīng)提交過作業(yè)不能再提交了
         if not (rs.bof and rs.eof) then
          rs.close
          set rs = nothing
          conn.close
          set conn = nothing
          response.write "<script>alert('你已經(jīng)提交過作業(yè)了');history.go(-1);</script>"
          response.end
         else
         ‘如果不存在則添加作業(yè)答案記錄
          rs.addnew
          rs("reid")=reid
          rs("name")=name
           rs("title")=title
            rs("message")=message
         ‘添加作業(yè)答案記錄成功
          rs.update
         ‘關(guān)閉記錄集對象
          rs.close
          set rs = nothing
         ‘關(guān)閉數(shù)據(jù)庫連接對象
          conn.close
          set conn = nothing
         end if
         response.write "<script>alert('添加成功');window.location.href='index.asp';</script>"
         %>
        3.1.6 教師基本信息頁
          1. teacherinfo.asp頁面示例
          圖3-6為顯示教師基本信息所看到的頁面。

        圖3-6  顯示教師基本信息
          2. 頁面中需要用戶填寫的Html表單元素
          此頁無需填寫Html表單元素。
          3. 頁面所涉及的數(shù)據(jù)庫表信息
          此頁面用來顯示教師基本信息,此頁使用了系統(tǒng)中的資料信息表main和教師信息表teacher。
          4. 頁面代碼分析
         <%’取得要顯示教師信息的id號
         id = trim(request("id"))
         if id = "" then
          conn.close
          set conn = nothing
          response.write "<script>alert('請不要搗亂');top.window.location.href='index.asp';</script>"
          response.end
         end if
         ‘判斷用戶是否是管理員
         if session("admin") = "admin" then
          isadmin = true
         else
          isadmin = false
         end if
         ‘判斷用戶是否是教師
         if session("teacherid") <> "" then
          isteacher = true
         else
          isteacher = false
         end if
         ‘取得教師詳細信息
         sql = "select * from teacher where teacherid="&id
         set rs = server.createobject("adodb.recordset")
         rs.open sql,conn,1,1
         %>
         ‘Html頁面顯示部分,顯示教師信息
         ……
         <%’關(guān)閉記錄集對象
         rs.close
         end if
         ‘取得欄目信息
         sql = "select * from type"
         rs.open sql,conn,1,1
         set rs1 = server.createobject("adodb.recordset")
         ‘所有欄目信息
         do while not rs.eof
          sql1 = "select count(mainid) from main where idofteacher="&id&" and idoftype="&rs("typeid")
         ‘取得教師在該欄目發(fā)表的資料總數(shù)
          rs1.open sql1,conn,1,1
          counter = rs1(0)
          rs1.close
         ‘發(fā)表的資料總數(shù)如果是3的倍數(shù)
          if counter mod 3 = 0 then
         ‘定義顯示資料記錄的框架的高度
           iframeheight = 20*(int(counter/3)+1)
          else
           iframeheight = 20*(int(counter/3)+2)
          end if
         ‘框架的高度最大值為220
          if iframeheight > 220 then iframeheight = 220
         %>
         <tr><td align="center" class="header" colspan=3>已在本站發(fā)布的<%=rs("type")%>(共<%=counter%>件)</td></tr>
         <tr><td align="center" colspan=3>
         ‘顯示資料記錄的框架頁
         <iframe name="titleof<%=rs("typeid")%>" frameborder=0 width=100% height=<%=iframeheight%> scrolling=no src=titlelist.asp?type=<%=rs("typeid")%>&id=<%=id%>></iframe>
         </td></tr>
         <%’取下一個欄目
          rs.movenext
         loop
         ‘關(guān)閉記錄集對象
         set rs1 = nothing
         ‘關(guān)閉記錄集對象
         rs.close
         set rs = nothing
         %>
         </table>
         <%’如果用戶既不是管理員也不是教師
         if not isadmin and not isteacher then
         %>
         <!--#include file="foot.asp"-->
         <%
         end if
         %>
         </body>
         </html>
         <%’關(guān)閉數(shù)據(jù)庫連接對象
         conn.close
         set conn = nothing
         %>
        3.1.7 資料信息搜索頁
          1. search.asp頁面示例
          圖3-7為搜索資料信息所看到的頁面。

        圖3-7搜索資料信息
          2. 頁面中需要用戶填寫的Html表單元素
          此頁共有5個表單元素,如表2所示。
          表2                    search.asp頁的表單元素
        名稱  表單元素類型 含義 最大長度
        fenlei1 Text 所屬學院 20
        feilei2 Text 所屬系 20
        Teacher Text 教師姓名 10
        Course Text 相關(guān)資料 20
        Titli Text 資料標題 20
          3. 頁面所涉及的數(shù)據(jù)庫表信息
          此頁面用來顯示搜索資料信息,此頁使用了系統(tǒng)中的資料欄目信息表type。
          4. 頁面代碼分析
         ‘Html頁面表單提交到list.asp
         <form action="list.asp" method="post">
         ‘Html頁面顯示部分,顯示要填寫的搜索條件
         ……
         </form>
        3.1.8 資料信息搜索結(jié)果頁
          1. list.asp頁面示例
          圖3-8為顯示資料信息列表所看到的頁面。
          
        3-8  顯示資料信息列表
          2. 頁面中需要用戶填寫的Html表單元素
          此頁無需填寫Html表單元素。
          3. 頁面所涉及的數(shù)據(jù)庫表信息
          此頁面用來顯示資料信息列表,使用了系統(tǒng)中的資料信息表main和教師信息表teacher。
        3.2  資料管理模塊
          資料管理模塊包含以下子模塊。
          ●  管理員登陸
          ●  資料欄目管理
          ●  資料信息管理
          管理員登陸子模塊包含以下頁面。
          ●  adminlogin.asp
          ●  asmincheck.asp
          ●  adminmain.asp
          資料欄目管理子模塊包含以下頁面。
          ●  addtype.asp
          ●  addtypeok.asp
          ●  edittype.asp
          ●  edittypeok.asp
          ●  deltype.asp
          ●  deltypeok.asp
          資料信息管理子模塊包含以下頁面。
          ●  put.asp
          ●  pubok.asp
          ●  list.asp
          ●  edit.asp
          ●  editok.asp
          ●  admindelcourseware.asp
          ●  admindelcoursewareok.asp
          各頁面間的關(guān)系如圖3-9所示。
         
        3-9  各頁面間的關(guān)系
        3.2.1 管理員登陸頁
          1. adminlogin.asp頁面示例
          圖3-10為管理員登陸所看到的頁面。管理員密碼為admin。

        圖3-10  管理員登陸
         2. 頁面中需要用戶填寫的Html表單元素
         此頁共有兩個表單元素,如表3所示。
         表3                    adminlogin.asp頁的表單元素
         名稱  表單元素類型  含義 最大長度
        Adminpwd Password 管理員密碼 15
          3. 頁面所涉及的數(shù)據(jù)庫表信息
          此頁并沒有涉及到數(shù)據(jù)庫表的操作。
          4. 頁面代碼分析
         ‘Html頁面表單提交到adminlogin.asp
         <form action="admincheck.asp" method="post">
         ‘Html頁面顯示部分,顯示要填寫的登陸信息
         ……
         </form>
        3.2.2 驗證管理員帳號頁
         1. 頁面中需要用戶填寫的Html表單元素
         此頁無需填寫Html表單元素。
         2. 頁面所涉及的數(shù)據(jù)庫表信息
         此頁面用來驗證管理員信息,使用了系統(tǒng)中的管理員表config。
         3. 頁面代碼分析
         ‘引用創(chuàng)建數(shù)據(jù)庫連接對象函數(shù)文件
         <!--#include file="conn.asp"-->
         <%’取得提交過來的信息
         adminpwd = request("adminpwd")
         ‘如果輸入的密碼為空
         if adminpwd = "" then
          conn.close
          set conn = nothing
          response.write "<script>alert('請輸入密碼');history.go(-1);</script>"
          response.end
         end if
         sql = "select * from config"
         set rs = server.createobject("adodb.recordset")
         rs.open sql,conn,1,1
         ‘如果輸入的密碼與數(shù)據(jù)庫中密碼一致說明密碼正確,登陸成功
         if adminpwd = rs("adminpwd") then
         ‘登陸成功后 session("admin")起用
         session("admin")=”admin”
          rs.close
          set rs = nothing
          conn.close
          set conn = nothing
         ‘登陸成功后就跳轉(zhuǎn)到管理頁面
          response.redirect "adminmain.asp"
         ‘如果輸入的密碼與數(shù)據(jù)庫中密碼不一致說明密碼輸入錯誤
         else
          rs.close
          set rs = nothing
          conn.close
          set conn = nothing
         response.write "<script>alert('密碼錯誤');window.location.href='adminlogin.asp';</script>"
        3.2.3 管理員登陸成功頁
          1.adminmain.asp頁面示例
          圖3-11為管理員登陸成功后所看到的頁面。

        圖3-11  管理員登陸成功
          2. 頁面中需要用戶填寫的Html表單元素
          此頁無需填寫Html表單元素。
          3. 頁面所涉及的數(shù)據(jù)庫表信息
          此頁使用了系統(tǒng)中的管理員表config。
          4. 頁面代碼分析
         ‘引用創(chuàng)建數(shù)據(jù)庫連接對象函數(shù)文件
         <!--#include file="conn.asp"-->
         ‘引用判斷是否是管理員登陸文件
         <!--#include file="isadmin.asp"-->
         ‘Html頁面顯示部分
         ……
         <frameset rows="*" cols="100,*,0" framespacing="0" frameborder="NO" border="0">
           <frame src="adminleft.asp" name="left" scrolling="NO" noresize>
           <frame src="adminindex.asp" name="main" noresize>
        3.2.4 增加資料欄目頁
          1. addtype.asp頁面示例
          圖3-12為增加欄目信息所看到的頁面。

          2. 頁面中需要用戶填寫的Html表單元素
          此頁僅有1個表單元素,如表4所示。
          表4                   addtype.asp頁的表單元素
        名稱  表單元素類型  含義 最大長度
        Addtype  Text 欄目名稱 10
          3. 頁面所涉及的數(shù)據(jù)庫表信息
          此頁面用來增加欄目信息,使用了系統(tǒng)中的欄目信息記錄表type。
          4. 頁面代碼分析
         <%’取得欄目信息
         sql = "select * from type"
         set rs = server.createobject("adodb.recordset")
         ‘打開記錄集對象
         rs.open sql,conn,1,1
         ‘顯示欄目信息
         do while not rs.eof
          response.write "<tr align='center'><td width=180>"&rs("type")&"</td>"
          response.write "<td><a href=edittype.asp?id="&rs("typeid")&">編輯</a>/<a href=deltype.asp?id="&rs("typeid")&">刪除</a></td></tr>"
         ‘取下一條欄目信息
          rs.movenext
         loop
         ‘關(guān)閉記錄集對象
         rs.close
         set rs = nothing
         ‘關(guān)閉數(shù)據(jù)庫連接對象
         conn.close
         set conn = nothing
         %>
         ‘Html頁面表單提交到addtype.doc
         <form action="addtypeok.asp" method="post">
         請輸入要添加的欄目名稱:<input type=text name="addtype" size=10><input type=submit name="submit" value="添加">
         <br>(欄目名稱可以如“論文”、“實驗素材”等)
         </form>
        3.2.5 增加欄目成功頁
          1. 頁面中需要用戶填寫的Html表單元素
          此頁無需填寫Html表單元素。
          2. 頁面所涉及的數(shù)據(jù)庫表信息
          此頁使用了系統(tǒng)中的欄目信息記錄表type。
          3. 頁面代碼分析
         ‘引用創(chuàng)建數(shù)據(jù)庫連接對象函數(shù)文件
         <!--#include file="conn.asp"-->
         ‘引用判斷是否是管理員登陸文件
         <!--#include file="isadmin.asp"-->
         <%’取得輸入的欄目名稱
         addtype = trim(request("addtype"))
         if addtype = "" then
          response.write "<script>alert('請輸入要添加的欄目名');history.go(-1);</script>"
          conn.close
          set conn = nothing
          response.end
         end if
         if len(addtype) > 5 then
          response.write "<script>alert('欄目名不得超過5個漢字');history.go(-1);</script>"
          conn.close
          set conn = nothing
          response.end
         end if
         ‘查找欄目信息表是否有欄目名相同的記錄
         sql = "select * from type where type='"&addtype&"'"
         set rs = server.createobject("adodb.recordset")
         rs.open sql,conn,1,3
         ‘如果有則提示
         if not (rs.bof and rs.eof) then
          rs.close
          set rs = nothing
          conn.close
          set conn = nothing
          response.write "<script>alert('數(shù)據(jù)庫中已經(jīng)有一個名為"&addtype&"的欄目了');history.go(-1);</script>"
          response.end
         else
         ‘如果沒有記錄則可以添加了
          rs.addnew
          rs("type")=addtype
          rs.update
         ‘關(guān)閉記錄集對象
          rs.close
          set rs = nothing
         ‘關(guān)閉數(shù)據(jù)庫連接對象
          conn.close
          set conn = nothing
         end if
         response.write "<script>alert('添加成功');window.location.href='addtype.asp';</script>"
         %>
        3.2.6 修改欄目信息頁
          1. edittype.asp頁面示例
          圖3-13為修改欄目信息所看到的頁面。

        圖3-13  修改欄目信息
          2. 頁面中需要用戶填寫的Html表單元素
          此頁僅有1個表單元素,如表5所示。
          表5                   edittype.asp頁的表單元素
         名稱  表單元素類型  含義 最大長度
        Addtype  Text 欄目名稱 10
          3. 頁面所涉及的數(shù)據(jù)庫表信息
          此頁用來修改欄目信息頁面,使用了系統(tǒng)中的欄目信息記錄表type。
          4. 頁面代碼分析
         ‘引用創(chuàng)建數(shù)據(jù)庫連接對象函數(shù)文件
         <!--#include file="conn.asp"-->
         ‘引用判斷是否是管理員登陸文件
         <!--#include file="isadmin.asp"-->
         <%’取得要修改欄目信息的id號
         id = trim(request("id"))
         sql = "select * from type where typeid="&id
         set rs = server.createobject("adodb.recordset")
         ‘打開欄目信息表查找需要修改的欄目名稱
         rs.open sql,conn,1,1
         filetype = rs("type")
         ‘關(guān)閉記錄集對象
         rs.close
         set rs = nothing
         ‘關(guān)閉數(shù)據(jù)庫連接對象
         conn.close
         set conn = nothing
         %>
         ‘Html頁面顯示部分
         ……
         ‘Html頁面表單提交到edittypeok.asp
         <form action="edittypeok.asp" method="post">
         將欄目“<%=filetype%>”更名為:<input type=text name="addtype" size=10 value="<%=filetype%>">
         <input type=hidden name="id" value="<%=id%>">
         <input type=submit name="submit" value="修改">
         <br>(欄目名稱可以如“論文”、“實驗素材”等)
         </form>
        3.2.7 保存修改的欄目信息頁
          1. 頁面中需要用戶填寫的Html表單元素
          此頁無需填寫Html表單元素。
          2. 頁面所涉及的數(shù)據(jù)庫表信息
          此頁使用了系統(tǒng)中的欄目信息記錄表type。
          3. 頁面代碼分析
         ‘引用創(chuàng)建數(shù)據(jù)庫連接對象函數(shù)文件
         <!--#include file="conn.asp"-->
         ‘引用判斷是否是管理員登陸文件
         <!--#include file="isadmin.asp"-->
         <%’取得要修改的欄目信息的id號
         id = trim(request("id"))
         addtype = trim(request("addtype"))
         ‘如果沒有輸入欄目名稱則提示
         if addtype = "" then
          response.write "<script>alert('請輸入欄目名');history.go(-1);</script>"
          conn.close
          set conn = nothing
          response.end
         end if
         ‘欄目名稱的長度不能大于5
         if len(addtype) > 5 then
          response.write "<script>alert('欄目名不得超過5個漢字');history.go(-1);</script>"
          conn.close
          set conn = nothing
          response.end
         end if
         ‘打開欄目信息表查找需要修改的欄目名稱
         sql = "select * from type where type='"&addtype&"' and typeid<>"&id
         set rs = server.createobject("adodb.recordset")
         rs.open sql,conn,1,1
         ‘如果修改的名稱在數(shù)據(jù)庫中已經(jīng)有記錄則不能修改
         if not (rs.bof and rs.eof) then
          rs.close
          set rs = nothing
          conn.close
          set conn = nothing
          response.write "<script>alert('數(shù)據(jù)庫中已經(jīng)有一個名為"&addtype&"的欄目了');history.go(-1);</script>"
          response.end
         end if
         rs.close
         set rs = nothing
         ‘如果修改的名稱在數(shù)據(jù)庫中沒有記錄了則可以修改
         conn.execute "update type set type='"&addtype&"' where typeid="&id
         conn.close
         set conn = nothing
         response.write "<script>alert('修改成功');window.location.href='addtype.asp';</script>"
         %>
        3.2.8 刪除欄目信息頁
          1. deltype.asp頁面示例
          圖3-14為刪除欄目信息所看到的頁面。

        圖3-14  刪除欄目信息
          2. 頁面中需要用戶填寫的Html表單元素
          此頁無需填寫Html表單元素。
          3. 頁面所涉及的數(shù)據(jù)庫表信息
          此頁使用了系統(tǒng)中的欄目信息記錄表type。
          4. 頁面代碼分析
         ‘Html頁面表單提交到deltypeok.asp
         <form action="deltypeok.asp" method="post">
         <table style="BORDER-COLLAPSE: collapse" borderColor=#808080 width="250" border="1" align="center" cellpadding=1>
         <tr><td align="center" class="header">將有下列數(shù)據(jù)被刪除</td></tr>
         <tr><td align="left">
         1.該欄目在數(shù)據(jù)庫中的記錄<br>
         2.所有屬于該欄目的資料
         </td></tr>
         </table>
         <center><input type=hidden name="id" value="<%=id%>"><br>
         <input type=submit name="submit" value="確定">&nbsp;&nbsp;<input type=button name="cancle" value="取消" onclick="history.go(-1);"></center>
         </form>
        3.2.9 刪除欄目信息成功頁
          1. 頁面中需要用戶填寫的Html表單元素
          此頁無需填寫Html表單元素。
          2. 頁面所涉及的數(shù)據(jù)庫表信息
          此頁使用了系統(tǒng)中的欄目信息記錄表type。
          3. 頁面代碼分析
         ‘引用創(chuàng)建數(shù)據(jù)庫連接對象函數(shù)文件
         <!--#include file="conn.asp"-->
         ‘引用判斷是否是管理員登陸文件
         <!--#include file="isadmin.asp"-->
         <%’取得要刪除欄目信息的id號
         id = trim(request("id"))
         ‘如果要刪除欄目信息的id號為空說明非法操作
         if id = "" then
          conn.close
          set conn = nothing
          response.write "<script>alert('請不要搗亂');top.window.location.href='adminmain.asp';</script>"
          response.end
         end if
         ‘查找對應(yīng)id號的欄目信息
         sql = "select * from type where typeid="&id
         set rs = server.createobject("adodb.recordset")
         ‘打開記錄集對象
         rs.open sql,conn,1,1
         ‘對應(yīng)id號的欄目信息如果不存在則說明該欄目不存在
         if rs.bof and rs.eof then
          rs.close
          set rs = nothing
          conn.close
          set conn = nothing
          response.write "<script>alert('請不要搗亂');top.window.location.href='adminmain.asp';</script>"
          response.end
         end if
         rs.close
         set rs = nothing
         ‘對應(yīng)id號的欄目信息如果存在則刪除欄目信息
         conn.execute "delete from type where typeid="&id
         ‘刪除資料信息中對應(yīng)欄目id號的資料信息
         conn.execute "delete from main where idoftype="&id
         ‘關(guān)閉數(shù)據(jù)庫連接對象
         conn.close
         set conn = nothing
         response.write "<script>alert('刪除成功');window.location.href='addtype.asp';</script>"
         %>
        3.2.10 發(fā)布資料信息頁
          1.pub.asp頁面示例
          圖3-15為發(fā)布資料信息所看到的頁面。

          2. 頁面中需要用戶填寫的Html表單元素
          此頁共有6個表單元素,如表6所示。
          表6                   pub.asp頁的表單元素
         名稱  表單元素類型  含義 最大長度
        Teacher Text 教師姓名 15
        Course Text 課程名稱 15
        Title Text 資料標題 52
        Fileurl Text 資料地址 52
        Filesize Text 資料大小 15
        content textarea 資料簡介 300
          3. 頁面所涉及的數(shù)據(jù)庫表信息
          此頁用來發(fā)布資料信息頁面,使用了系統(tǒng)中的欄目信息記錄表type。
          4. 頁面代碼分析
         ‘Html頁面表單提交到pubok.asp
         <form action="pubok.asp" method="post" onSubmit=submitonce(this)>
         ‘Html頁面顯示部分,填寫資料信息
         ……
         <%’取得欄目信息
         sql = "select * from type"
         set rs = server.createobject("adodb.recordset")
         rs.open sql,conn,1,1
         %>
         &nbsp;<select name="type">
         <option value="" selected>請選擇</option>
         <%’顯示欄目信息
         do while not rs.eof
         %>
          <option value="<%=rs("typeid")%>"><%=rs("type")%></option>
         <%’取下一條欄目信息
          rs.movenext
         loop
         response.write "</select>"
         ‘關(guān)閉記錄集對象
         rs.close
         set rs = nothing
         %>
        3.2.11 資料信息發(fā)布成功頁
          1. 頁面中需要用戶填寫的Html表單元素
          此頁無需填寫Html表單元素。
          2. 頁面所涉及的數(shù)據(jù)庫表信息
          此頁使用了系統(tǒng)中的資料信息記錄表main。
        3.2.12 資料信息列表頁
          圖3-16為資料信息列表頁面。

          2. 頁面中需要用戶填寫的Html表單元素
          此頁無需填寫Html表單元素。
          3. 頁面所涉及的數(shù)據(jù)庫表信息
          此頁面用來顯示資料信息列表,使用了系統(tǒng)中的資料信息表main和教師信息表teacher。
          4. 頁面代碼分析
          代碼與3.2.8節(jié)的刪除欄目信息頁基本相同。
        3.2.13 資料信息修改頁
          1. edit.asp頁面示例
          圖3-17為修改資料信息所看到的頁面。

        圖3-17  修改資料信息
          2. 頁面中需要用戶填寫的Html表單元素
          此頁共有5個表單元素,如表7所示。
          表7                   edit.asp頁的表單元素
         名稱  表單元素類型  含義 最大長度
        Course  Text 課題名稱 15
        Title  Text 資料標題 52
        Fileurl  Text 資料地址 52
        Filesize  Text 資料大小 15
        Content Textarea 資料簡介 300
          3. 頁面所涉及的數(shù)據(jù)庫表信息
          此頁用來修改資料信息,使用了系統(tǒng)中的資料信息記錄表main。
          4. 頁面代碼分析
         ‘引用創(chuàng)建數(shù)據(jù)庫連接對象函數(shù)文件
         <!--#include file="conn.asp"-->
         ‘引用判斷是否是教師登陸文件
         <!--#include file="isteacher.asp"-->
         ‘引用網(wǎng)站設(shè)置文件
         <!--#include file="fenlei.asp"-->
         <%’取得要修改資料信息的id號
         id = request("id")
         ‘必須輸入要修改資料信息的id號
         if id = "" then
          conn.close
          set conn = nothing
          response.write "<script>alert('請不要搗亂');top.window.location.href='teachermain.asp';</script>"
          response.end
         end if
         ‘取得要顯示的資料信息
         sql = "select * from main,teacher where main.idofteacher=teacher.teacherid and main.mainid="&id
         set rs = server.createobject("adodb.recordset")
         rs.open sql,conn,1,1
         ‘如果信息不存在則不能修改
         if rs.bof and rs.eof then
          rs.close
          set rs = nothing
          conn.close
          set conn = nothing
          response.write "<script>alert('請不要搗亂');top.window.location.href='teachermain.asp';</script>"
          response.end
         else
         ‘如果存在判斷用戶是否有修改資料的權(quán)限
          if rs("teacherid") <> int(session("teacherid")) and session("admin") <> "admin" then
           rs.close
           set rs = nothing
           conn.close
           set conn = nothing
           response.write "<script>alert('這個資料不是你發(fā)布的,你想干什么?');top.window.location.href='teachermain.asp';</script>"
           response.end
          end if
         end if
         %>
         ‘Html頁面顯示部分,顯示要修改的資料信息
         ……
        3.2.14 保存修改的資料信息頁
          1. 頁面中需要用戶填寫的Html表單元素
          此頁無需填寫Html表單元素。
          2. 頁面所涉及的數(shù)據(jù)庫表信息
          此頁使用了系統(tǒng)中的資料信息表main和教師信息表teacher。
          3. 頁面代碼分析
         ‘引用創(chuàng)建數(shù)據(jù)庫連接對象函數(shù)文件
         <!--#include file="conn.asp"-->
         ‘引用判斷是否是教師登陸文件
         <!--#include file="isteacher.asp"-->
         ‘引用網(wǎng)站設(shè)置文件
         <!--#include file="fenlei.asp"-->
         <%’取得表單提交的信息
         'on error resume next
         course = server.htmlencode(trim(request("course")))
         fileurl = server.htmlencode(trim(request("fileurl")))
         content = server.htmlencode(trim(request("content")))
         title = server.htmlencode(trim(request("title")))
         typeid = trim(request("type"))
         filesize = int(trim(request("filesize")))
         id = request("id")
         ‘必須輸入修改的資料的id號
         if id = "" then
          conn.close
          set conn = nothing
          response.write "<script>alert('請不要搗亂');top.window.location.href='teachermain.asp';</script>"
          response.end
         end if
         ‘必須輸入資料名稱
         if course = "" then
          conn.close
          set conn = nothing
          response.write "<script>alert('請輸入資料名稱');history.go(-1);</script>"
          response.end
         end if
         if len(course) > 25 then
          conn.close
          set conn = nothing
          response.write "<script>alert('資料名稱不得超過25個漢字');history.go(-1);</script>"
          response.end
         end if
         if fileurl = "" then
          conn.close
          set conn = nothing
          response.write "<script>alert('請輸入資料地址');history.go(-1);</script>"
          response.end
         end if
         if len(fileurl) > 100 then
          conn.close
          set conn = nothing
          response.write "<script>alert('資料地址不得超過100個英文字母');history.go(-1);</script>"
          response.end
         end if
         if title = "" then
          conn.close
          set conn = nothing
          response.write "<script>alert('請輸入資料標題');history.go(-1);</script>"
          response.end
         end if
         if len(title) > 25 then
          conn.close
          set conn = nothing
          response.write "<script>alert('資料標題不得超過25個漢字');history.go(-1);</script>"
          response.end
         end if
         if typeid = "" then
          conn.close
          set conn = nothing
          response.write "<script>alert('請選擇資料類型');history.go(-1);</script>"
          response.end
         end if
         if filesize < 1 then filesize = 0
         if content = "" then
          conn.close
          set conn = nothing
          response.write "<script>alert('請輸入簡介');history.go(-1);</script>"
          response.end
         end if
         ‘取得要修改的資料信息
         sql = "select * from main where mainid="&id
         set rs = server.createobject("adodb.recordset")
         rs.open sql,conn,1,3
         ‘如果要修改的資料信息不存在
         if rs.bof and rs.eof then
          rs.close
          set rs = nothing
          conn.close
          set conn = nothing
          response.write "<script>alert('請不要搗亂');top.window.location.href='teachermain.asp';</script>"
          response.end
         else
         ‘判斷用戶是否有修改資料的權(quán)限
          if rs("idofteacher") <> int(session("teacherid")) and session("admin") <> "admin" then
           rs.close
           set rs = nothing
           conn.close
           set conn = nothing
           response.write "<script>alert('這個資料不是你發(fā)布的,你想干什么?');top.window.location.href='teachermain.asp';</script>"
           response.end
          else
         ‘如果有修改權(quán)限就修改資料信息
           rs("fileurl")=fileurl
           rs("course")=course
           rs("dateandtime")=now()
           rs("content")=content
           rs("title")=title
           rs("idoftype")=cint(typeid)
           rs("filesize")=filesize
         ‘修改成功
           rs.update
         ‘關(guān)閉記錄集對象
           rs.close
           set rs = nothing
         ‘關(guān)閉數(shù)據(jù)庫連接對象
           conn.close
           set conn = nothing
          end if
         end if
         
         response.write "<script>alert('修改成功');window.location.href='edit.asp?id="&id&"';</script>"
        3.2.15 刪除資料信息頁
          1. admindelcourseware.asp頁面示例
          圖3-18為刪除資料信息所看到的頁面

        圖3-18  個人基本檔案
          2. 頁面中需要用戶填寫的Html表單元素
          此頁無需填寫Html表單元素。
          3. 頁面所涉及的數(shù)據(jù)庫表信息
          此頁并沒有涉及到數(shù)據(jù)庫表的操作。
          4. 頁面代碼分析
         ‘Html頁面表單提交到admindelcoursewareok.asp刪除資料信息
         <form action="admindelcoursewareok.asp" method="post">
         <table style="BORDER-COLLAPSE: collapse" borderColor=#808080 width="250" border="1" align="center" cellpadding=1>
         <tr><td align="center" class="header">將有下列數(shù)據(jù)被刪除</td></tr>
         <tr><td align="left">
         1.該資料在數(shù)據(jù)庫中的記錄<br>
         2.與該資料相關(guān)的已上傳資料
         </td></tr>
         </table>
         <center><input type=hidden name="id" value="<%=id%>"><input type=hidden name="teacherid" value="<%=teacherid%>"><br>
         <input type=submit name="submit" value="確定">&nbsp;&nbsp;<input type=button name="cancle" value="取消" onclick="history.go(-1);"></center>
         </form>
        3.2.16 刪除資料信息成功頁
          1. 頁面中需要用戶填寫的Html表單元素
          此頁無需填寫Html表單元素。
          2. 頁面所涉及的數(shù)據(jù)庫表信息
          此頁使用了系統(tǒng)中的資料信息表main。
          3. 頁面代碼分析
         ‘引用創(chuàng)建數(shù)據(jù)庫連接對象函數(shù)文件
         <!--#include file="conn.asp"-->
         ‘引用判斷是否是管理員登陸文件
         <!--#include file="isadmin.asp"-->
         <%’取得教師信息的id號
         id = trim(request("id"))
         teacherid = trim(request("teacherid"))
         ‘必須輸入教師id號和資料信息id號
         if id = "" or teacherid = "" then
          conn.close
          set conn = nothing
          response.write "<script>alert('請不要搗亂');top.window.location.href='adminmain.asp';</script>"
          response.end
         end if
         ‘取得資料信息
         sql = "select * from main where mainid="&id
         set rs = server.createobject("adodb.recordset")
         ‘打開記錄集對象
         rs.open sql,conn,1,1
         ‘判斷信息是否存在,如果不存在則不能刪除信息
         if rs.bof and rs.eof then
          rs.close
          set rs = nothing
          conn.close
          set conn = nothing
          response.write "<script>alert('請不要搗亂');top.window.location.href='adminmain.asp';</script>"
          response.end
         else
         ‘如果信息存在則先取到文件地址先刪除
          fileurl = rs("fileurl")
          rs.close
          set rs=nothing
         '如果資料已上傳至本地,則刪除資料
          if left(fileurl,6) = "files/" and mid(fileurl,7,len(teacherid)+2) = teacherid&"at" then
           dim filepaths,objFSO
           on error resume next
           Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
           filepaths=Server.MapPath(""&fileurl&"")
           if objFSO.fileExists(filepaths) then
            objFSO.DeleteFile(filepaths)
           end if
           set objFSO = nothing
          end if
         ‘刪除資料信息
          conn.execute "delete from main where mainid="&id
         ‘關(guān)閉記錄集對象
          conn.close
          set conn = nothing
          response.write "<script>alert('刪除成功');window.location.href='list.asp?teacherid="&teacherid&"';</script>"
         end if
         %>
        3.3  教師管理
          教師模塊包含以下頁面。
          ● adminteacher.asp
          ●  adminsearchteacher.asp
          ●  addteacher.asp
          ●  addteacherok.asp
          ●  editteacher.asp
          ●  editteacherok.asp
          ●  delteacher.asp
          ●  delteacherok.asp
          各頁面間的關(guān)系如圖3-19所示。

        3-19  各頁面間的關(guān)系

        3.3.1 搜索教師頁
          1. adminteacher.asp頁面示例
          圖3-20為搜索教師信息所看到的頁面。

        圖3-20 搜索教師信息
          2. 頁面中需要用戶填寫的Html表單元素
          此頁共有4個表單元素,如表8所示。
          表8                    adminteacher.asp頁的表單元素
         名稱  表單元素類型 含義 最大長度
        Fenlei1 text 教師所屬學院 15
        Fenlei2 Text 教師所屬系 15
        Teacher Text 教師姓名 15
        Id Text 教師ID 15
          3. 頁面所涉及的數(shù)據(jù)庫表信息
          此頁并沒有涉及到數(shù)據(jù)庫表的操作。
          4. 頁面代碼分析
         ‘Html頁面表單提交到adminsearchteacher.asp搜索教師
         <form action="adminsearchteacher.asp" method="post">
         ‘Html頁面顯示部分,填寫教師搜索信息
         ……
         </form>
        3.3.2 教師搜索結(jié)果頁
          1. adminsearchteacher.asp頁面示例
          圖3-21為教師信息列表所看到的頁面。

        圖3-21  教師信息列表
          2. 頁面中需要用戶填寫的Html表單元素
          此頁無需填寫Html表單元素。
          3. 頁面所涉及的數(shù)據(jù)庫表信息
          此頁面用來顯示教師信息列表,使用了系統(tǒng)中的教師信息表teacher。

        3.3.3 添加教師信息頁
          1. addteacher.asp頁面示例
          圖3-22為添加教師信息所看到的頁面。

        3-22  添加教師信息
          2. 頁面中需要用戶填寫的Html表單元素
          此頁用來添加教師信息,頁面中共有13個表單元素,如表9所示。
          表9                    addteacher.asp頁的表單元素
         名稱  表單元素類型  含義 最大長度
        Fenlei1 text 教師所屬學院 25
        Fenlei2 text 教師所屬系 25
        Teacher text 教師姓名 25
        Loginname text 登陸名 22
        Password text 密碼 25
        Password1 text 確認密碼 25
        Ask text 密碼找回問題 25
        Answer text 密碼找回答案 25
        Email text 電子郵件 25
        Homepage text 個人主頁 25
        Qq text QQ號碼 25
        Address text 通訊地址 25
        intro textarea 個人簡介 150

         3. 頁面所涉及的數(shù)據(jù)庫表信息
          此頁并沒有涉及到數(shù)據(jù)庫表的操作。
          4. 頁面代碼分析
         ‘Html頁面表單提交到addteacherok.asp增加教師信息
         <form action="addteacherok.asp" method="post" onSubmit=submitonce(this)>
         ‘Html頁面顯示部分,填寫教師信息
         ……
         </form>
        3.3.4 添加教師成功頁
          1. 頁面中需要用戶填寫的Html表單元素
          此頁無需填寫Html表單元素。
          2. 頁面所涉及的數(shù)據(jù)庫表信息
          此頁使用了系統(tǒng)中的教師信息表teacher。
          
        3.3.5 修改教師信息頁
          1. editteacher.asp頁面示例
          圖3-23為修改教師信息所看到的頁面。

        圖3-23  修改教師信息
          2. 頁面中需要用戶填寫的Html表單元素
          此頁用來修改教師信息,頁面中共有14個表單元素,如表10所示。
          表10                editteacher.asp頁的表單元素

        名稱 表單元素類型 含義 最大長度
        Fenlei1 Text 教師所屬學院 25
        Fenlei2 Text 教師所屬系 25
        Teacher Text 教師姓名 25
        Loginname Text 登陸名 22
        Password Text 密碼 25
        Password1 Text 確認密碼 25
        Ask Text 密碼找回問題 25
        Answer Text 密碼找回答案 25
        Email Text 電子郵件 25
        Homepage Text 個人主頁 25
        Qq Text QQ號碼 25
        Address Text 通訊地址 25
        Photourl Text 照片地址 25
        intro Textarea 個人簡介 150
         3. 頁面所涉及的數(shù)據(jù)庫表信息
          此頁使用了系統(tǒng)中的教師信息表teacher。
          4. 頁面代碼分析
         ‘引用創(chuàng)建數(shù)據(jù)庫連接對象函數(shù)文件
         <!--#include file="conn.asp"-->
         ‘引用網(wǎng)站設(shè)置文件
         <!--#include file="fenlei.asp"-->
         ‘引用判斷是否是管理員登陸文件
         <!--#include file="isadmin.asp"-->
         <%’取得要刪除教師信息的id號
         id = request("id")
         if id = "" then
          conn.close
          set conn = nothing
          response.write "<script>alert('請不要搗亂!!!');top.window.location.href='adminmain.asp';</script>"
         end if
         ‘取得對應(yīng)教師id號的教師信息
         sql = "select * from teacher where teacherid="&id
         set rs = server.createobject("adodb.recordset")
         ‘打開記錄集對象
         rs.open sql,conn,1,1
         %>
         ‘Html頁面顯示部分,顯示資料的修改信息
         ……
         <%’顯示教師是否允許登陸
         if rs("locked") = 1 then
          response.write "<input type=radio name=locked value='0'>允許登陸"
          response.write "<input type=radio name=locked value='1' checked>禁止登陸"
         else
          response.write "<input type=radio name=locked value='0' checked>允許登陸"
          response.write "<input type=radio name=locked value='1'>禁止登陸"
         end if
         ‘關(guān)閉記錄集對象
         rs.close
         set rs = nothing
         ‘關(guān)閉數(shù)據(jù)庫連接對象
         conn.close
         set conn = nothing
         %>
        3.3.6 修改教師信息成功頁
          1. 頁面中需要用戶填寫的Html表單元素
          此頁無需填寫Html表單元素。
          2. 頁面所涉及的數(shù)據(jù)庫表信息
          此頁使用了系統(tǒng)中的教師信息表teacher。
        3.3.7 刪除教師信息頁
          1. delteacher.asp頁面示例
          圖3-24為刪除教師信息所看到的頁面。

          2. 頁面中需要用戶填寫的Html表單元素
          此頁無需填寫Html表單元素。
          3. 頁面所涉及的數(shù)據(jù)庫表信息
          此頁并沒有涉及到數(shù)據(jù)庫表的操作。
          4. 頁面代碼分析
         ‘Html頁面表單提交到delteacherok.asp刪除教師信息
         <form action="delteacherok.asp" method="post">
         ‘Html頁面顯示部分
        3.3.8 刪除教師信息成功頁
          2. 頁面中需要用戶填寫的Html表單元素
          此頁無需填寫Html表單元素。
          3. 頁面所涉及的數(shù)據(jù)庫表信息
          此頁使用了系統(tǒng)中的教師信息表teacher。
        第四章 數(shù)據(jù)庫結(jié)構(gòu)設(shè)計
         根據(jù)系統(tǒng)功能設(shè)計要求和模塊劃分,本站的數(shù)據(jù)庫主要存儲資料信息、教師信息、回復信息和欄目信息。
         
        4.1 數(shù)據(jù)庫需求分析
          數(shù)據(jù)項和數(shù)據(jù)結(jié)構(gòu)如下。
        資料信息表: MainID(自動編號)、標題、簡介、文件大小、文件類型、更新日期、相關(guān)課程、教師姓名、文件地址和下載次數(shù)等。
        教師信息: teacherid(自動編號)、教師姓名、所屬學院、所屬系、E-mail地址、個人主頁、QQ號碼和通訊地址。
        回復作業(yè)表:ID(自動編號)、學生姓名、作業(yè)標題、作業(yè)內(nèi)容、作業(yè)的id號和回復日期。
        欄目信息表:typeID(自動編號)、欄目名稱。

        4.2 數(shù)據(jù)庫邏輯設(shè)計
          1. 資料信息表main,如圖4-1所示。

        圖4-1  資料信息表
          2. 教師信息表teacher,如圖4-2所示。

          3. 回復作業(yè)表work,如圖4-3所示。

        圖3-3  回復作業(yè)表
          4. 欄目信息表type,如圖4-4所示。

        圖4-4  欄目信息表
        4.3 數(shù)據(jù)庫連接說明
          Conn.asp文件的數(shù)據(jù)庫連接程序如下。
          <% Set conn = Server.CreateObject("ADODB.Connection")
        conn.open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" &server.mappath("edu.mdb")&";"
        %>
        第五章 測試和維護

        5.1 網(wǎng)站維護

        1、服務(wù)器及相關(guān)軟硬件的維護,對可能出現(xiàn)的問題進行評估,制定響應(yīng)時間。
        2、數(shù)據(jù)庫維護,有效地利用數(shù)據(jù)是網(wǎng)站維護的重要內(nèi)容,因此數(shù)據(jù)庫的維護要受到重視。
        3、內(nèi)容的更新、調(diào)整等。
        4、制定相關(guān)網(wǎng)站維護的規(guī)定,將網(wǎng)站維護制度化、規(guī)范化。

        5.2 網(wǎng)站測試

        網(wǎng)站發(fā)布前要進行細致周密的測試,以保證正常瀏覽和使用。主要測試內(nèi)容:
        1、服務(wù)器穩(wěn)定性、安全性。
        2、程序及數(shù)據(jù)庫測試。
        3、網(wǎng)頁兼容性測試,如瀏覽器、顯示器。
        4、根據(jù)需要的其他測試。
        參考文獻

        [1] 龍馬工作室. ASP+Access 組建動態(tài)網(wǎng)站 實例精講. 人民郵電出版社,2005
        [2] 于繁華.Access基礎(chǔ)教程. 中國水利水電出版社,2006
        [3] 阮文江. java script程序設(shè)計基礎(chǔ)教程. 人民郵電出版社,2006
        致謝
         經(jīng)過兩個月的忙碌和工作,本次畢業(yè)設(shè)計已經(jīng)接近尾聲,由于經(jīng)驗的匱乏,難免有許多考慮不周全的地方,如果沒有輔導老師的督促指導,以及一起工作的同學們的支持,想要完成這個設(shè)計是難以想象的。
         在這里首先要感謝我的輔導老師葉劍春。他平日里工作繁多,但在我做畢業(yè)設(shè)計的每個階段,從外出實習到查閱資料,設(shè)計草案的確定和修改,中期檢查,后期詳細設(shè)計,裝配草圖等整個過程中都給予了我悉心的指導。我的設(shè)計較為復雜煩瑣,但是葉劍春老師仍然細心地糾正圖紙中的錯誤。除了敬佩葉劍春老師的專業(yè)水平外,他的治學嚴謹和科學研究的精神也是我永遠學習的榜樣,并將積極影響我今后的學習和工作。
         其次要感謝幫助我一起作畢業(yè)設(shè)計的眾多網(wǎng)友,他們在本次設(shè)計中給了我大力的幫助,出謀劃策各展所能的幫助我完成此次畢業(yè)設(shè)計,如果沒有他們的大力幫助,此次設(shè)計的完成將變得非常困難。
         然后還要感謝大學三年來所有的老師,為我們打下計算機專業(yè)知識的基礎(chǔ);同時還要感謝所有的同學們,正是因為有了你們的支持和鼓勵。此次畢業(yè)設(shè)計才會順利完成。
         最后感謝工商職業(yè)學院三年來對我的大力栽培。

        【ASP在線教育系統(tǒng)(一)】相關(guān)文章:

        ASP05-29

        ASP 3.0高級編程(二)05-29

        在線課程網(wǎng)站設(shè)計開題報告(通用8篇)12-22

        分析配網(wǎng)線路在線檢測方式的創(chuàng)新理工論文05-04

        異徑HDPE管穿插法修復在線舊管道-05-28

        北京市電力公司主變壓器局部放電在線檢測方法研究08-07

        一物一權(quán)原則質(zhì)疑12-06

        一帶一路論文參考文獻范例09-19

        對汽車維修服務(wù)業(yè)的一項研究(一)05-12

        国产高潮无套免费视频_久久九九兔免费精品6_99精品热6080YY久久_国产91久久久久久无码

        1. <tt id="5hhch"><source id="5hhch"></source></tt>
          1. <xmp id="5hhch"></xmp>

        2. <xmp id="5hhch"><rt id="5hhch"></rt></xmp>

          <rp id="5hhch"></rp>
              <dfn id="5hhch"></dfn>