<?php include("session.php"); ?>
<html>
<head>
<title>前景网考企业版</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>

<?php include("conn.php") ?>


<?php 
    //-------------本程序同时处理单科目试题和多科目试题------------------------------------
	
	$get_duoke_database_str=$_GET["duoke_database_str"];

?>

 <?   
	
	   //'------------本身就是在正式考试模式下的文件---不必说明正式考试条件------------------
	   
	   //---------如果是多科目试题，从此截断，直接赋值----------------------------------
	 
	   
		$duokemu_flag=0;
		
		$sql="select  * from  random_shiti where juan_id=0 ";
	    $rs=$conn->execute($sql);
		if (!$rs->EOF)
		{
		    $duokemu_flag=1;
			$read_juan_id=0;
		}	   
		$rs->close;
		
		
		if ($duokemu_flag==1)
		{
		
			$sql="select  * from  random_shiti where juan_id=0 and  coursename='".$get_duoke_database_str."'";
	    	$rs=$conn->execute($sql);
			if (!$rs->EOF)
			{
		    	$duokemu_flag=1;
				//--------二次登录时间从URL读取，不是从数据库读取--------
		    	//$read_falltime=$rs->fields["exam_time"];
				//$read_zongfen=$rs->fields["zongfen"];
				$read_database_name=$rs->fields["coursename"];
				$read_juan_name=$read_database_name;
				$read_juan_id=0;
			}	   
			$rs->close;
		
		}
		
		
		
		
		
	
?>
    

<? 

 
  //--------单科目试题，从数据库读取---------------------------
  if  ($duokemu_flag==0) 
  {
   
     $read_juan_id=$_GET["juan_id"];
	 
     $sql="select  *  from  database_name  where   id=";
     $sql=$sql."  (select  database_id  from  fenlei   where   id=".$read_juan_id.")";
     $rs=$conn->execute($sql);

     if (!$rs->EOF)
     {
       $read_database_name=$rs->fields["database_name"];
     } 

     $rs->close;
	 
	 $sql="select  *  from  fenlei  where   id=".$read_juan_id;
     $rs=$conn->execute($sql);
     if (!$rs->EOF)
     {
        $read_juan_name=$rs->fields["exam_juan_name"];
     } 
     $rs->close;
	 
     $conn->close;
   
  }
  

?>
 
<? 


   $read_stuid=$_GET["stuid"];
   $read_stuname=$_GET["stuname"];
   $read_stuclass=$_GET["stuclass"];
   
   //------
   $read_falltime=$_GET["falltime"];
   $read_exammode=$_GET["exammode"];
   $read_shitihao=$_GET["shitihao"];
  
   $read_zongfen=$_GET["zongfen"];



?>
 
 
 
<? 

  //---------但科目juan_id非0 ，多科目为0---------------------------------
	$s_exist=0;
	$d_exist=0;
	$t_exist=0;
	$p_exist=0;
	$lunshu_exist=0;
	$sql="select  *  from    studentanswer    where   stuid='".$read_stuid."'";
	$sql=$sql."   and   juan_id=".$read_juan_id;
	
	$rs=$conn->execute($sql);

	if (!$rs->EOF)
	{

  		$get_s=$rs->fields["rom_s"];
  		$get_d=$rs->fields["rom_d"];
  		$get_t=$rs->fields["rom_t"];
  		$get_p=$rs->fields["rom_p"];
  		$get_lunshu=$rs->fields["rom_lunshu"];
  
  		if ($get_s!='' || $get_s!="")
  		{
    		$s_exist=1;
  		} 

  		if ($get_d!='' || $get_d!="")
  		{
    		$d_exist=1;
  		} 

  		if ($get_t!='' || $get_t!="")
  		{
    		$t_exist=1;
  		} 

  		if ($get_p!='' || $get_p!="")
  		{
    		$p_exist=1;
  		} 

  		if ($get_lunshu!='' || $get_lunshu!="")
  		{
   			 $lunshu_exist=1;
  		} 
	} 

	$rs->close;
	$conn->close;
	
	

?>


 
    
   
 
 
 <?php



		//---------3SESSION--------------------------------------
		//---------------------------------------------------
		$_SESSION["stu_log"]=1;
		//---------------------------------------------------

		//正式考试模式，要赋值，特别重要---------------------------------
		$_SESSION["studentid"]=$read_stuid;
		//-----------------------------------------------------
		$_SESSION["exam_mode"]=$read_exammode;
		//-------------------------------------------------------
		$_SESSION["database_name"]=$read_database_name;
		//--------------------------------------------------
		$_SESSION["juan_id"]=$read_juan_id;
		//----------------------------------------------------------
		
		

		if  ($duokemu_flag==0) 
		{

			$stu_code=urlencode($read_stuname);
			$stuclass_code=urlencode($read_stuclass);
			
			
			$url_url="newleft.php?stuid=".$read_stuid;
			$url_url=$url_url."&stuname=".$stu_code;
			$url_url=$url_url."&stuclass=".$stuclass_code;
			$url_url=$url_url."&juan_id=".$read_juan_id;
			$url_url=$url_url."&zongfen=".$read_zongfen;
			$url_url=$url_url."&falltime=".$read_falltime;
			$url_url=$url_url."&exammode=".$read_exammode;
			$url_url=$url_url."&shitihao=".$read_shitihao;
			

		}


		if  ($duokemu_flag==1) 
		{

			$stu_code=urlencode($read_stuname);
			$stuclass_code=urlencode($read_stuclass);
			
			$url_url="newleft_m.php?stuid=".$read_stuid;
			$url_url=$url_url."&stuname=".$stu_code;
			$url_url=$url_url."&stuclass=".$stuclass_code;
			$url_url=$url_url."&juan_id=".$read_juan_id;
			$url_url=$url_url."&zongfen=".$read_zongfen;
			$url_url=$url_url."&falltime=".$read_falltime;
			$url_url=$url_url."&exammode=".$read_exammode;
			$url_url=$url_url."&shitihao=".$read_shitihao;
			$url_url=$url_url."&duoke_database_str=".urlencode($read_database_name);
			
		

		}
	
		
?>

 <frameset rows="*" cols="230,*" framespacing="0" frameborder="NO" border="0">
  <frame src=<?php echo $url_url; ?> name="myleft" scrolling="NO" noresize marginwidth="2">
  <?php if ($s_exist==1) {?>  
   <frame src="a0middle_s.php?page=1" name="mainframe"  scrolling="auto">
  <?php } ?>
  <?php if ($d_exist==1) {?>  
   <frame src="a0middle_d.php?page=1" name="mainframe"  scrolling="auto">
  <?php } ?>
  <?php if ($t_exist==1) {?>  
   <frame src="a0middle_tiankong.php?page=1" name="mainframe"  scrolling="auto">
  <?php } ?>
  <?php if ($p_exist==1) {?>  
   <frame src="a0middle_panduan.php?page=1" name="mainframe"  scrolling="auto">
  <?php } ?>
  <?php if ($lunshu_exist==1) {?>  
   <frame src="a0middle_lunshu.php?page=1" name="mainframe"  scrolling="auto">
  <?php } ?>
</frameset>
<noframes><body>
</body></noframes>
</html>