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

📄 cover2.asp

📁 是一个电子商务网站的功能介绍
💻 ASP
📖 第 1 页 / 共 5 页
字号:
<!--#include file="conn.asp"-->
 <meta http-equiv="Content-Language" content="zh-cn">
 <%
  if session("username")="" then
  response.redirect "relogin.asp"
  end if

%>
<%
   username= cstr(trim(request.Cookies("username")))


'------添加练习题
sql="select tbtk.* from tbtk,tbkc,tbchapter where tbkc.kcid=tbtk.kcid and tbkc.kcid=tbchapter.kcid and tbtk.chapter=tbchapter.chapter and testopen=1 and  kao=0"
set rs=server.createobject("adodb.recordset")
rs.open sql,conn,3,2

do while not rs.eof

sql1="select * from userdata where username='"&username&"' and paperno=0 and  tmid="&rs("tmid")
set rs1=server.createobject("adodb.recordset")
rs1.open sql1,conn,3,2

    if  rs1.EOF then
    rs1.addnew
    rs1("username")=username
    rs1("tmid")=cint(rs("tmid"))
    rs1("ans")=rs("ans")
    rs1("paperno")=0
    rs1("isread")=rs("isread")
    rs1.update
    
     '--------------------------阅读题肢
       if rs("isread")=1 then
       sqlkao0="select * from tbread  where  tmid="&rs("tmid")
       set rskao0=server.createobject("adodb.recordset")
       rskao0.open sqlkao0,conn,3,2
       
          do while not rskao0.eof
          
          sqlkao1="select * from userdataread  where username='"&username&"' and paperno=0 and  tmid="&rs("tmid")
          set rskao1=server.createobject("adodb.recordset")
          rskao1.open sqlkao1,conn,3,2
             
             sqldata1="select top 1 * from userdata where username='"&username&"' and paperno=0 and tmid="&rs("tmid")&" order by dataid desc"
 			 set rsdata1=server.createobject("adodb.recordset")
			 rsdata1.open sqldata1,conn,3,2
             
              
              rskao1.addnew
              rskao1("username")=username
              rskao1("dataid")=rsdata1("dataid")
              rskao1("tmid")=rskao0("tmid")
              rskao1("noid")=rskao0("noid")
              rskao1("paperno")=0
              rskao1("rans")=rskao0("readans")
              rskao1("readno")=rskao0("readno")
              rskao1("fen")=0 
              rskao1.update
           
           
           rskao0.movenext
          loop
       
       end if
     '--------------------------阅读题肢

    
   end if


rs.movenext
loop


'------添加练习题信息
sql3="select distinct tbtk.kcid,tbtk.kao,tbtk.chapter  from tbtk,tbkc,tbchapter  where tbkc.kcid=tbtk.kcid  and tbkc.kcid=tbchapter.kcid and tbtk.chapter=tbchapter.chapter and  testopen=1 and kao=0 order by tbtk.kcid "
set rs3=server.createobject("adodb.recordset")
rs3.open sql3,conn,3,2

do while not rs3.eof
  	sql2="select  * from tbistest where username='"&username&"' and kcid="&rs3("kcid")&" and chapter="&rs3("chapter")
	set rs2=server.createobject("adodb.recordset")
	rs2.open sql2,conn,3,2

   if  rs2.eof then   
   	rs2.addnew
   	rs2("username")=username
    rs2("kcid")=cint(rs3("kcid"))
   	rs2("kao")=cint(rs3("kao"))
 	rs2("istest")=0
 	rs2("chapter")=cint(rs3("chapter"))
    rs2.update
    end if 
rs3.movenext
loop







'-----------添加考试题 
'-----------考试权限
	sqluser="select * from tbuser where username='"&username&"'"
	set rsuser=server.createobject("adodb.recordset")
	rsuser.open sqluser,conn,3,2
	
	nianji=rsuser("nianji")
	banji=rsuser("banji")
	
	sqlnian="select * from tbnianji where nianji='"&nianji&"'"
	set rsnian=server.createobject("adodb.recordset")
	rsnian.open sqlnian,conn,3,2

	sqlban="select * from tbbanji where banji='"&banji&"'"
	set rsban=server.createobject("adodb.recordset")
	rsban.open sqlban,conn,3,2
	
	nianjiid=rsnian("nianjiid")
	banjiid=rsban("banjiid")
	
	sqlpower="select * from tbpower  where banjiid="&banjiid&" and nianjiid="&nianjiid
	set rspower=server.createobject("adodb.recordset")
	rspower.open sqlpower,conn,3,2
	
	power=rspower("power")


'---------------------细分权限


         	idlistt=power
         	if instr(idlistt,",")>0 then
			
			idArra=split(idlistt)
			dim paperno
		    for j = 0 to ubound(idarra)
	       		paperno=clng(idarra(j))
	       		
	       	'----------paperno是试卷号,开始从第一张试卷抽题
	       	
	       	'--------------------添加考试信息
	       	
	 sqlpaper="select * from tbpaper where paperno="&paperno
 	set rspaper=server.createobject("adodb.recordset")
	rspaper.open sqlpaper,conn,3,2

	kcid=rspaper("kcid")
	
  	sql5="select  * from tbscore where username='"&username&"' and paperno="&paperno
	set rs5=server.createobject("adodb.recordset")
	rs5.open sql5,conn,3,2
	
	sqlkc="select  * from tbkc where kcid="&kcid
	set rskc=server.createobject("adodb.recordset")
	rskc.open sqlkc,conn,3,2
	
if rskc("isopen")=1 then
if rspaper("isopen")=1 then  '---------如果试卷打开\关闭
   if  rs5.eof then   
   	rs5.addnew
   	rs5("username")=username
    rs5("kcid")=kcid
    rs5("paperno")=paperno
    rs5("lasttime")=rspaper("paperdatetime")
    rs5.update
   
			'----------------------------
	       	   	Set rs00=Server.CreateObject("Adodb.RecordSet")
   				sql00="select * from userdata "
   				rs00.open sql00,conn,3,2
   				
   				if rspaper("ischoose")=1 then '------------------固定试题
   				
   				    Set rssel=Server.CreateObject("Adodb.RecordSet")
                    sqlsel="select * from tbselectpaper  where paperno="&paperno
                    rssel.open sqlsel,conn,3,2
   				    
   				    do while not rssel.eof
   				    
   				        Set rsistm=Server.CreateObject("Adodb.RecordSet")
    					sqlistm="select * from userdata where  username='"&username&"' and  tmid="&rssel("tmid")&" and  paperno="&paperno
   						rsistm.open sqlistm,conn,3,2
   				    
   				    if  rsistm.eof  then
	   
     				rs00.addnew
     				rs00("username")=username
     				rs00("tmid")=rssel("tmid")
     				rs00("ans")=rssel("ans")
     				rs00("isread")=rssel("isread")
     				rs00("paperno")=paperno
     				rs00.update
     				
     				     
          '--------------------------阅读题肢
       if rssel("isread")=1 then
       sqlkaoshi0="select * from tbread  where  tmid="&rssel("tmid")
       set rskaoshi0=server.createobject("adodb.recordset")
       rskaoshi0.open sqlkaoshi0,conn,3,2
       
          do while not rskaoshi0.eof
          
          sqlkaoshi1="select * from userdataread  where username='"&username&"' and paperno<>0 and  tmid="&rssel("tmid")
          set rskaoshi1=server.createobject("adodb.recordset")
          rskaoshi1.open sqlkaoshi1,conn,3,2
             
             sqldatashi1="select top 1 * from userdata where username='"&username&"' and paperno="&paperno&" and tmid="&rssel("tmid")&" order by dataid desc"
 			 set rsdatashi1=server.createobject("adodb.recordset")
			 rsdatashi1.open sqldatashi1,conn,3,2
             
              
              rskaoshi1.addnew
              rskaoshi1("username")=username
              rskaoshi1("dataid")=rsdatashi1("dataid")
              rskaoshi1("tmid")=rskaoshi0("tmid")
              rskaoshi1("paperno")=paperno
              rskaoshi1("noid")=rskaoshi0("noid")
              rskaoshi1("readno")=rskaoshi0("readno")
              rskaoshi1("rans")=rskaoshi0("readans")
              rskaoshi1("fen")=0 
              rskaoshi1.update
           
           
           rskaoshi0.movenext
          loop
       
       end if
     '--------------------------阅读题肢
     
     				
     				
     				end if
     				
                    rssel.movenext
   				    loop
   				else
   				
   			'-----------------------------试卷参数'kcid,schap,echap
   			schap=rspaper("schap")
			echap=rspaper("echap")
   			'-----------------------随机选6题名词解释,防止漏选
    Set rs11=Server.CreateObject("Adodb.RecordSet")
    sql11="select * from tbtk where kao=1 and category=1 and kcid="&kcid&" and (chapter Between "&schap&" And "&echap&")"
      rs11.open sql11,conn,3,2
      
 if not rs11.eof then  
    Set rsno1=Server.CreateObject("Adodb.RecordSet")
    sqlno1="select * from tbkcconfig where kcid="&kcid&" and category=1 and paperno="&paperno
   rsno1.open sqlno1,conn,3,2
   
   
    randomize
    i=1
    
   for i=1 to rsno1("datano") 

    a=int((rs11.RecordCount-0)*rnd+0)

    if ( a>0 and a<(rs11.RecordCount+1)) then 
       rs11.absoluteposition=a
    
    	set rs22=conn.execute("select * from userdata where username='"&username&"' and  tmid="&rs11("tmid")&" and paperno="&paperno)
 	
     	 if  rs22.eof  then
	   
     rs00.addnew
     rs00("username")=username
     rs00("tmid")=cint(rs11("tmid"))
     rs00("ans")=rs11("ans")
     rs00("paperno")=paperno
     rs00.update
     
     else
     
     i=i-1
          
          end if 
    end if 
     next
     
   '-------
    Set rscheck11=Server.CreateObject("Adodb.RecordSet")
    sqlcheck11="select distinct userdata.tmid from userdata,tbtk  where userdata.tmid=tbtk.tmid and userdata.username='"&username&"' and  tbtk.kao=1 and tbtk.category=1 and tbtk.kcid="&kcid&" and (tbtk.chapter Between "&schap&" And "&echap&")  and userdata.paperno="&paperno&" order by userdata.tmid"
    rscheck11.open sqlcheck11,conn,3,2
      
      if rscheck11.RecordCount < rsno1("datano")  then
    
      wrong1=rsno1("datano")-rscheck11.RecordCount
    ' response.write  "<br>wrong1="&wrong1
    '  response.write rscheck11.RecordCount&"<"& rsno1("datano")
      rs11.movefirst
        for k1=1 to wrong1
          you1=0
        
      if not rscheck11.eof then
          rscheck11.movefirst
      
          
         do while not rscheck11.eof  
    '     response.write  "<br>rs11="&rs11("tmid")
     '     response.write  "==rscheck11="&rscheck11("tmid")
          
            if  cint(rs11("tmid"))=cint(rscheck11("tmid")) then
              you1=1
            end if            
          rscheck11.movenext
          loop      
     end if
     
     
      '    response.write "<br>---you1="&you1
           
          if you1=1 then
            if not  rs11.eof then
            rs11.movenext
            end if 
            k1=k1-1
       '     response.write  "<br>k1="&k1&"下一个<br>"
          else   
            
            rs00.addnew
     		rs00("username")=username
     		rs00("tmid")=cint(rs11("tmid"))
     		rs00("ans")=rs11("ans")
     		rs00("paperno")=paperno
            rs00.update
              
            if not rs11.eof then
            rs11.movenext
            end if 
        '     response.write  "<br>k1="&k1&"加入一个<br>"
          
          end if
                   
        next
      end if 
      
   '---------- 
end if
 '------------------随机选6题填空题,防止漏选
    Set rs12=Server.CreateObject("Adodb.RecordSet")
    sql12="select * from tbtk where kao=1 and category=2 and kcid="&kcid&" and (chapter Between "&schap&" And "&echap&")"
      rs12.open sql12,conn,3,2
     
 if not rs12.eof then  
    Set rsno2=Server.CreateObject("Adodb.RecordSet")
    sqlno2="select * from tbkcconfig where kcid="&kcid&" and category=2 and paperno="&paperno
   rsno2.open sqlno2,conn,3,2
   
   
    randomize
    i=1
    
   for i=1 to rsno2("datano") 

    a=int((rs12.RecordCount-0)*rnd+0)

    if ( a>0 and a<(rs12.RecordCount+1)) then 
       rs12.absoluteposition=a
    
    	set rs22=conn.execute("select * from userdata where username='"&username&"' and  tmid="&rs12("tmid")&" and paperno="&paperno)
 	
     	 if  rs22.eof  then
	   
     rs00.addnew
     rs00("username")=username
     rs00("tmid")=cint(rs12("tmid"))
     rs00("ans")=rs12("ans")
     rs00("paperno")=paperno
     rs00.update
     
     else
     
     i=i-1
          
          end if 
    end if 
     next
     
   '-------
    Set rscheck12=Server.CreateObject("Adodb.RecordSet")
    sqlcheck12="select distinct userdata.tmid from userdata,tbtk  where  userdata.tmid=tbtk.tmid and userdata.username='"&username&"' and  tbtk.kao=1 and tbtk.category=2 and tbtk.kcid="&kcid&" and (tbtk.chapter Between "&schap&" And "&echap&")  and userdata.paperno="&paperno&" order by userdata.tmid"
    rscheck12.open sqlcheck12,conn,3,2
    
     
        
      if rscheck12.RecordCount < rsno2("datano")  then
      
      
      wrong2=rsno2("datano")-rscheck12.RecordCount
     'response.write  "<br>wrong2="&wrong2
     ' response.write rscheck12.RecordCount&"<"& rsno2("datano")
      rs12.movefirst
        for k2=1 to wrong2
          you2=0
        
        if not rscheck12.eof then
          rscheck12.movefirst
         do while not rscheck12.eof  
      '   response.write  "<br>rs12="&rs12("tmid")
      '    response.write  "==rscheck12="&rscheck12("tmid")
          
            if  cint(rs12("tmid"))=cint(rscheck12("tmid")) then
              you2=1
            end if            
          rscheck12.movenext
          loop      
        end if
        
        '  response.write "<br>---you2="&you2
           
          if you2=1 then

⌨️ 快捷键说明

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