论文首页哲学论文经济论文法学论文教育论文文学论文历史论文理学论文工学论文医学论文管理论文艺术论文 |
图3-10 管理员登陆
2. 页面中需要用户填写的Html表单元素
此页共有两个表单元素,如表3所示。
表3 adminlogin.asp页的表单元素
名称 表单元素类型 含义 最大长度
Adminpwd Password 管理员密码 15
3. 页面所涉及的数据库表信息
此页并没有涉及到数据库表的操作。
4. 页面代码分析
‘Html页面表单提交到adminlogin.asp
<form action="admincheck.asp" method="post">
‘Html页面显示部分,显示要填写的登陆信息
……
</form>
3.2.2 验证管理员帐号页
1. 页面中需要用户填写的Html表单元素
此页无需填写Html表单元素。
2. 页面所涉及的数据库表信息
此页面用来验证管理员信息,使用了系统中的管理员表config。
3. 页面代码分析
‘引用创建数据库连接对象函数文件
<!--#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
‘如果输入的密码与数据库中密码一致说明密码正确,登陆成功 大学排名
if adminpwd = rs("adminpwd") then
‘登陆成功后 session("admin")起用
session("admin")=”admin”
rs.close
set rs = nothing
conn.close
set conn = nothing
‘登陆成功后就跳转到管理页面
response.redirect "adminmain.asp"
‘如果输入的密码与数据库中密码不一致说明密码输入错误
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. 页面所涉及的数据库表信息
此页使用了系统中的管理员表config。
4. 页面代码分析
‘引用创建数据库连接对象函数文件
<!--#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页的表单元素 (转载自中国科教评价网http://www.nseac.com)
名称 表单元素类型 含义 最大长度
Addtype Text 栏目名称 10
3. 页面所涉及的数据库表信息
此页面用来增加栏目信息,使用了系统中的栏目信息记录表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
‘关闭记录集对象
rs.close
set rs = nothing
‘关闭数据库连接对象
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. 页面所涉及的数据库表信息
此页使用了系统中的栏目信息记录表type。
3. 页面代码分析
‘引用创建数据库连接对象函数文件
<!--#include file="conn.asp"-->
‘引用判断是否是管理员登陆文件 (科教作文网 zw.nseac.com整理)
<!--#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('数据库中已经有一个名为"&addtype&"的栏目了');history.go(-1);</script>"
response.end
else
‘如果没有记录则可以添加了
rs.addnew
rs("type")=addtype
rs.update
‘关闭记录集对象
rs.close
set rs = nothing
‘关闭数据库连接对象
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所示。
您可以访问中国科教评价网(www.NsEac.com)查看更多相关的文章。
(科教范文网http://fw.ΝsΕΑc.com编辑)
图3-14 删除栏目信息
2. 页面中需要用户填写的Html表单元素
此页无需填写Html表单元素。
3. 页面所涉及的数据库表信息
此页使用了系统中的栏目信息记录表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">将有下列数据被删除</td></tr>
<tr><td align="left">
1.该栏目在数据库中的记录<br>
2.所有属于该栏目的资料
</td></tr>
</table>
<center><input type=hidden name="id" value="<%=id%>"><br>
<input type=submit name="submit" value="确定"> <input type=button name="cancle" value="取消" onclick="history.go(-1);"></center>
</form>
3.2.9 删除栏目信息成功页
1. 页面中需要用户填写的Html表单元素
此页无需填写Html表单元素。
2. 页面所涉及的数据库表信息
此页使用了系统中的栏目信息记录表type。
3. 页面代码分析
‘引用创建数据库连接对象函数文件
<!--#include file="conn.asp"-->
‘引用判断是否是管理员登陆文件
<!--#include file="isadmin.asp"-->
<%’取得要删除栏目信息的id号
2. 页面中需要用户填写的Html表单元素
此页共有6个表单元素,如表6所示。
表6 pub.asp页的表单元素
名称 表单元素类型 含义 最大长度
2. 页面中需要用户填写的Html表单元素
此页无需填写Html表单元素。
3. 页面所涉及的数据库表信息
此页面用来显示资料信息列表,使用了系统中的资料信息表main和教师信息表teacher。 (科教作文网http://zw.ΝsΕAc.Com编辑整理)
4. 页面代码分析
代码与3.2.8节的删除栏目信息页基本相同。
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. 页面所涉及的数据库表信息
此页用来修改资料信息,使用了系统中的资料信息记录表main。
4. 页面代码分析
‘引用创建数据库连接对象函数文件
<!--#include file="conn.asp"-->
‘引用判断是否是教师登陆文件
<!--#include file="isteacher.asp"-->
‘引用网站设置文件
<!--#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")