📄 testpage_gl.asp
字号:
<!--#include file="open.asp" -->
<!--#include file="inc/md5.inc" -->
<%Server.ScriptTimeOut=1000%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<!--#include file="inc/css.css" -->
<title>试卷管理</title>
</head>
<body topmargin="1">
<!--#include file="inc/top.asp" -->
<!--#include file="inc/menu.asp" -->
<%'新增试卷写入
doing=request.querystring("doing")
str="select * from test_tm"
set rs=conn.execute(str)
tmcount=0
do while not rs.eof
tmcount=tmcount+1
rs.movenext
loop
if doing="insert" then
test_name=trim(request.form("test_name"))
test_bj=request.form("test_bj")
test_date=trim(request.form("test_date"))
begin_time=trim(request.form("begin_time"))
end_time=trim(request.form("end_time"))
test_sl=request.form("test_sl")
if test_sl="" then
msg="试题数量不能为空"
else
test_sl=int(test_sl)
end if
if test_name="" then
msg="请写出考试的名称"
else
if isdate(test_date)=flase then
msg="无效的考试日期"
else
if isdate(begin_time)=flase or isdate(end_time)=flase then
msg="无效的时间格式"
else
if test_sl>tmcount then
msg="试题数超过试题库中试题数量"
else
fz=100/test_sl
table_name=cstr(year(date()))&cstr(month(date()))&cstr(day(date()))&cstr(hour(time()))&cstr(minute(time()))&cstr(second(time()))
pg="0"
str="insert into test_gl(考试名称,考试班级,考试日期,开考时间,结束时间,试题数量,每题分值,数据表名,批改) values('"&test_name&"','"&test_bj&"','"&test_date&"','"&begin_time&"','"&end_time&"',"&test_sl&","&fz&",'"&table_name&"','"&pg&"')"
'response.write str
set rs=conn.execute(str)
'生成试卷
str="select * into "&table_name&" from user_st where 1<>1"
conn.execute(str)
str="insert into "&table_name&" select * from user_st"
conn.execute(str)
str="delete from "&table_name&" where class<>'"&test_bj&"'"
conn.execute(str)
'建立班级学生的试卷
fz=100/test_sl
tt=1
dd="0"
do while tt<test_sl
dd=dd&"0"
tt=tt+1
loop
str="update "&table_name&" set 每题分值="&fz&",答对数=0,答错数=0,总得分=0,考试日期='"&test_date&"',开始时间='"&begin_time&"',结束时间='"&end_time&"',答案='"&dd&"'"
conn.execute(str)
str="select * from "&table_name&""
set rs=conn.execute(str)
m=0
do while not rs.eof
m=m+1
rs.movenext
loop
n=1
do while n<=m
'建立一个学生的试卷
str="select * from "&table_name&""
set rs=conn.execute(str)
x=0
do while x<n
id1=rs("id")
x=x+1
rs.movenext
loop
i=1
do while i<=test_sl
rnd1=rnd()*second(time())
rnd2=int(rnd1)
rnd3=rnd1-rnd2
testid=int(rnd3*(tmcount+1))
str="select * from create_test_temp where 试题编号="&testid&""
set rs=conn.execute(str)
if rs.eof then
str="select * from test_tm where id="&testid&""
set rs=conn.execute(str)
if not rs.eof then
testid1=rs("id")
da_OK=rs("da")
if testid1<10 then
testid2="000"&cstr(testid1)
end if
if testid1>=10 and testid1<100 then
testid2="00"&cstr(testid1)
end if
if testid1>=100 and testid1<1000 then
testid2="0"&cstr(testid1)
end if
if testid1>=1000 then
testid2=cstr(testid1)
end if
str="insert into create_test_temp(试题编号,编号文本,正确答案) values("&testid1&",'"&testid2&"','"&da_OK&"')"
conn.execute(str)
i=i+1
end if
end if
loop
str="select * from create_test_temp"
set rs=conn.execute(str)
all_testid=""
all_da_OK=""
do while not rs.eof
all_testid=all_testid&rs("编号文本")
all_da_OK=all_da_OK&rs("正确答案")
rs.movenext
loop
str="delete from create_test_temp"
conn.execute(str)
str="update "&table_name&" set 试题编号='"&all_testid&"',正确答案='"&all_da_OK&"' where id="&id1&""
conn.execute(str)
n=n+1
loop
end if
end if
end if
end if
end if
%>
<% if session("zzteacher")=flase then
page_user=request.form("page_user")
page_user=trim(page_user)
page_pass=trim(request.form("page_pass"))
page_pass=ucase(md5(page_pass))
str="select * from user_te where teacher_user='"&page_user&"' and teacher_pass='"&page_pass&"'"
set rs=conn.execute(str)
if not rs.eof then
session("zzteacher")=true
if rs("teacher_jb")=99 then
session("adminadmin")=true
end if
end if
end if
%>
<table width="770" border="1" align="center" cellpadding="0" cellspacing="0" bordercolor="ff99cc" bgcolor="edebeb">
<tr>
<td width="200" valign="top">
<table width="163" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td class="unnamed6"> </td>
</tr>
<tr>
<td background="images/nxmt_lj_46.gif" class="unnamed10"> </td>
</tr>
<tr>
<td background="images/nxmt_lj_44.gif" class="unnamed14">
<div align="center">用户登录</div></td>
</tr>
<tr>
<td background="images/nxmt_lj_44.gif" class="unnamed12">
<div align="center">
<% if session("zzteacher")=flase then%>
<form name="form1" method="post" action="">
用户名:
<input name="page_user" type="text" id="page_user" size="12" maxlength="15">
<br>
<br>
密 码:
<input name="page_pass" type="password" id="page_pass" size="12" maxlength="15">
<br>
<br>
<input name="Submit" type="submit" value=" 登 录 ">
</form>
<% else
response.write "<br><br>已登录 <a href=quit.asp>退出</a>"
response.write "<br><br><a href=stlx_setup.asp?lx=no&back=testpage_gl.asp>设置为没有练习状态</a>"
response.write "<br><br><a href=stlx_setup.asp?lx=yes&back=testpage_gl.asp>设置为练习状态</a>"
end if
%>
</div></td>
</tr>
<tr>
<td background="images/nxmt_lj_44.gif" class="unnamed6"> </td>
</tr>
<tr>
<td background="images/nxmt_lj_45.gif" class="unnamed10"> </td>
</tr>
</table></td>
<td width="570" valign="top">
<%if session("zzteacher")=false then%>
<table width="570" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="440"><img src="images/bg01.jpg" width="440" height="185">
</td>
<td width="130"><img src="images/xxkj.jpg" width="130" height="185"></td>
</tr>
</table>
<%end if%>
<% if session("zzteacher")=true then%>
<% str="select * from test_gl"
set rs=conn.execute(str)
pagecount=0
do while not rs.eof
pagecount=pagecount+1
rs.movenext
loop%>
<table width="560" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td class="unnamed10"> </td>
</tr>
<tr>
<td class="unnamed14"><div align="center"><strong><font color="#0000FF">已有试卷列表 </font></strong>共有
<%=pagecount%> 个试卷
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td class="unnamed6"> </td>
</tr>
</table>
<strong><font color="#0000FF"> </font></strong>
<% if pagecount>0 then%>
<table width="100%" border="1" cellpadding="0" cellspacing="0" class="unnamed12">
<tr valign="middle" bgcolor="#999999">
<td height="20"> <div align="center">考试名称</div></td>
<td height="20"> <div align="center">考试班级</div></td>
<td height="20"> <div align="center">考试日期</div></td>
<td height="20"> <div align="center">开考时间</div></td>
<td height="20"> <div align="center">结束时间</div></td>
<td height="20"> <div align="center">试题数量</div></td>
<td height="20"> <div align="center">删除</div></td>
</tr>
<% str="select * from test_gl"
set rs=conn.execute(str)
do while not rs.eof%>
<tr>
<td height="20"> <div align="center"><%=rs("考试名称")%></div></td>
<td height="20"> <div align="center"><%=rs("考试班级")%></div></td>
<td height="20"> <div align="center"><%=rs("考试日期")%></div></td>
<td height="20"> <div align="center"><%=rs("开考时间")%></div></td>
<td height="20"> <div align="center"><%=rs("结束时间")%></div></td>
<td height="20"> <div align="center"><%=rs("试题数量")%></div></td>
<td height="20"> <div align="center"><%if session("adminadmin")=true then response.write "<a href=page_del.asp?del_id="&rs("id")&">删除</a>" else response.write " " end if%></div></td>
</tr>
<%rs.movenext%>
<%loop%>
</table>
<%end if%>
<strong><font color="#0000FF"> </font></strong></div></td>
</tr>
</table>
<%end if%>
<%if session("zzteacher")=true then%>
<table width="568" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="570" valign="top">
<table width="570" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><div align="center" class="unnamed14">
<hr>
<strong>新增试卷操作</strong></div></td>
</tr>
</table>
<form name="form2" method="post" action="testpage_gl.asp?doing=insert">
<table width="568" border="1" cellpadding="0" cellspacing="0" class="unnamed12">
<tr bgcolor="#999999">
<td height="20"><div align="center">考试名称</div></td>
<td height="20"><div align="center">考试班级</div></td>
<td height="20"><div align="center">考试日期</div></td>
<td height="20"><div align="center">开考时间</div></td>
<td height="20"><div align="center">结束时间</div></td>
<td height="20"><div align="center">试题数量</div></td>
</tr>
<tr>
<td height="20"><div align="center">
<input name="test_name" type="text" id="test_name" size="20" maxlength="50">
</div></td>
<td height="20"><div align="center">
<select name="test_bj" id="test_bj">
<% str="select * from bj"
set rs=conn.execute(str)
do while not rs.eof%>
<option value=<%=rs("bj_name")%>><%=rs("bj_name")%></option>
<%rs.movenext
loop%>
</select>
</div></td>
<td height="20"><div align="center">
<input name="test_date" type="text" id="test_date" value="<%=date()%>" size="10" maxlength="10">
</div></td>
<td height="20"><div align="center">
<input name="begin_time" type="text" id="begin_time" value="<%=time()%>" size="8" maxlength="8">
</div></td>
<td height="20"><div align="center">
<input name="end_time" type="text" id="end_time" value="<%=time()%>" size="8" maxlength="8">
</div></td>
<td height="20"><div align="center">
<input name="test_sl" type="text" id="test_sl" size="3" maxlength="3">
</div></td>
</tr>
</table>
<div align="center">
<table width="568" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="80%" height="40" valign="bottom">
<div align="center">
<input type="submit" name="Submit2" value=" 增 加 ">
</div></td>
<td width="20%" valign="top" class="unnamed12">
<div align="right">试题总数:<%=tmcount%> </div></td>
</tr>
</table>
</div>
</form>
</td>
</tr>
</table>
<div align="center" class="unnamed14"> <font color="#FF0000">
<%if msg<>"" then response.write msg end if%>
<%end if%>
</font></div></td>
</tr>
</table>
<!--#include file="inc/bottom.asp" -->
</body>
</html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -