ASP生成静态网页,学习CASE的用法,以及“权限”的一种控制方法

发表日期:2016/7/19 16:37:50 浏览次数:

 

...


<% if session("logstatus")<>1 then %>
  


   你还没有登录,没有权利浏览本页,请先登录


<%
else
'读取login.htm附带的SubjectNo、StudentID及Name参数值
Subject=Request("Subject")
StudentID=Request("StudentID")
Name=Request("Name")

********  路径和文件的建立 ********************************************************************
'格式化日期
Function format(date)
            format=datepart("yyyy",date)&"年"&datepart("m",date)&"月"&datepart("d",date)&"日&nbsp;"&formatdatetime(date,vbshorttime)
End Function
dim fmonth,fday,fhour,fminute,fsecond
fmonth=month(date)
if len(month(date))<2 then fmonth="0"&month(date) end if
fday=day(date)
if len(day(date))<2 then fday="0"&day(date) end if
fhour=hour(now())
if len(hour(now()))<2 then fhour="0"&hour(now()) end if
fminute=minute(now())
if len(minute(now()))<2 then fminute="0"&minute(now()) end if
fsecond=second(now())
if len(second(now()))<2 then fsecond="0"&second(now()) end if
newspath=year(date)&fmonth&fday
newsurl=fhour&fminute&fsecond
putdate=format(now())

if request("action")="do" then

path=server.MapPath("kaoshi")  /.定义的一个文件
set fso=server.CreateObject("Scripting.FileSystemObject")
if fso.FolderExists(path)=false then
fso.CreateFolder(path)
end if
path=path&"/"&newspath
if fso.FolderExists(path)=false then
fso.CreateFolder(path)
end if
path=path&"/"&newsurl&".shtml"  /.生成SHTML页面

set ts=fso.OpenTextFile(path,2,true,-2)

******** 生成HTML页面  ***********************************************************************
ts.writeline""
ts.writeline""
ts.writeline""&name&""<BR>ts.writeline","&subject&""<BR>ts.writeline" - 成绩结果"
ts.writeline""
ts.writeline""
ts.writeline""
ts.writeline""

ts.writeline""
ts.writeline"

"
ts.writeline""
ts.writeline"
"
ts.writeline"

"
ts.writeline""&Name&""
ts.writeline",你的考试成绩如下表:

"

dim score
score=0
sqlt="select * from 考题类型"
rst.open sqlt,conn,1,1
do while not rst.eof
tn=rst("id")
tname=rst("name")

ts.writeline""
ts.writeline""&tname&""
ts.writeline"


"

sql="Select * From "&Subject&" where 题目类型="&tn&" order by 题目序号"
rs.open sql,conn,2,2
while not rs.eof
 answer=rs("正确答案")
 select case rs("题目类型")
  case 1:
  selection=Request("No"&rs("题目序号"))
ts.writeline rs("题目序号")
ts.writeline"、"&selection&"
"
  case 2:
        selection=""
       for n=1 to 4
  if not Request("No"&rs("题目序号")&"-"&n)="" then
         selection=selection&Request("No"&rs("题目序号")&"-"&n)
  end if
        next
ts.writeline rs("题目序号")       
ts.writeline" 、"&selection&"
"
  case 3:    
        selection=Request(rs("选择项1"))
ts.writeline rs("题目序号")        
ts.writeline"、"&selection&"
"
        case else:
        selection=Request(rs("选择项1"))
ts.writeline rs("题目序号")
ts.writeline"、"        
ts.writeline"未确定评分规则!
"
ts.writeline""&selection&"
"
end select
if answer=selection then
  score=score+rs("本题分数")
end if
rs.movenext
wend

rs.close
ts.writeline"
"
rst.movenext
loop
'response.write score
'response.end

ts.writeline"
"
ts.writeline"评分:"
ts.writeline""&score&""
ts.writeline"
"
ts.writeline"

"
ts.writeline""
ts.writeline""
end if
%>


移动设备浏览《ASP生成静态网页,学习CASE的用法,以及“权限”的一种控制方法》请扫描二维码, 欢迎访问更多相关内容

公司座机:0519-85115799 服务热线:13357899835 EMAIL:admin@seo-fox.cn
业务QQ:285700415 公司地址:常州市新北区太湖东路9-2号创意大厦1502
上海股权托管交易中心 企业代码:205675
在我们眼里,一个网站应该是专业的,易于操作的,更重要的是:网站是强大的营销工具,让潜在客户了解你的公司提供的更多产品或服务
我们只做有价值的网站!
0
MAP
2007-2015 © 常州网狐信息技术有限公司