<?php 
session_start(); //开着身份验证，以
include("./sql/conn.php"); /////写
header("Content-type: text/html; charset=utf-8"); 
$llym = $_SERVER["HTTP_REFERER"];
include("./zj/yz.php"); /////写
?>




<?php
$result = mysql_query("SELECT * FROM ".$b_qz."_ks where id='".$_SESSION['id']."' " );/// DESC 
while($row = mysql_fetch_array($result))
{

		$result_a = mysql_query("SELECT * FROM ".$b_qz."_ks_name where name='".$_SESSION['ksnr']."' " );/// DESC 
		while($row_a = mysql_fetch_array($result_a))
		{
		$tk = $row_a['tk'];
		$dan = $row_a['dan'];
		$duo = $row_a['duo'];
		$pan = $row_a['pan'];
		}

	if(strlen($row['w1'])!=0)
	{}else{
/////////////////////////////////////////////////////////////////////////	

$zgid1 = a;
$zgid2 = a;
$zgid3 = a;//////重要说明！/////下边的三次抽题，不能省，因为不同的题数量不同

mysql_query("DELETE FROM ".$b_qz."_dt WHERE adm='".$_SESSION['id']."' and ksnr='".$_SESSION['ksnr']."' ");



$result = mysql_query("SELECT * FROM ".$b_qz."_tk where tk_name='".$tk."' and tx='单选' ORDER BY rand() LIMIT ".$dan." " );/// DESC 
while($row = mysql_fetch_array($result))
{
   if ($_SESSION['id']==$zgid1 or $_SESSION['id']==$zgid2 or $_SESSION['id']==$zgid3){
   mysql_query("INSERT INTO ".$b_qz."_dt (w, d, z, tx, adm, ksnr) VALUES ('".$row['id']."','".$row['ans']."','".$row['ans']."','".$row['tx']."','".$_SESSION['id']."','".$_SESSION['ksnr']."')");
   }else{
   mysql_query("INSERT INTO ".$b_qz."_dt (w, z, tx, adm, ksnr) VALUES ('".$row['id']."','".$row['ans']."','".$row['tx']."','".$_SESSION['id']."','".$_SESSION['ksnr']."')");
   }
}






$result = mysql_query("SELECT * FROM ".$b_qz."_tk where tk_name='".$tk."' and tx='多选' ORDER BY rand() LIMIT ".$duo." " );/// DESC 
while($row = mysql_fetch_array($result))
{
   if ($_SESSION['id']==$zgid1 or $_SESSION['id']==$zgid2 or $_SESSION['id']==$zgid3){
mysql_query("INSERT INTO ".$b_qz."_dt (w, d, z, tx, adm, ksnr) VALUES ('".$row['id']."','".$row['ans']."','".$row['ans']."','".$row['tx']."','".$_SESSION['id']."','".$_SESSION['ksnr']."')");
   }else{
mysql_query("INSERT INTO ".$b_qz."_dt (w, z, tx, adm, ksnr) VALUES ('".$row['id']."','".$row['ans']."','".$row['tx']."','".$_SESSION['id']."','".$_SESSION['ksnr']."')");
   }
}






$result = mysql_query("SELECT * FROM ".$b_qz."_tk where tk_name='".$tk."' and tx='判断' ORDER BY rand() LIMIT ".$pan." " );/// DESC 
while($row = mysql_fetch_array($result))
{
   if ($_SESSION['id']==$zgid1 or $_SESSION['id']==$zgid2 or $_SESSION['id']==$zgid3){
mysql_query("INSERT INTO ".$b_qz."_dt (w, d, z, tx, adm, ksnr) VALUES ('".$row['id']."','".$row['ans']."','".$row['ans']."','".$row['tx']."','".$_SESSION['id']."','".$_SESSION['ksnr']."')");
   }else{
mysql_query("INSERT INTO ".$b_qz."_dt (w, z, tx, adm, ksnr) VALUES ('".$row['id']."','".$row['ans']."','".$row['tx']."','".$_SESSION['id']."','".$_SESSION['ksnr']."')");
   }
}




mysql_query("UPDATE ".$b_qz."_ks SET w1 = 'on',
									 w1time = '".$noww."'
	WHERE id='".$_SESSION['id']."' " );/// DESC 
/////////////////////////////////////////////////////////////////////////	
	}
}

?>












<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>开始考试</title>
<link href="css/css.css" rel="stylesheet" type="text/css" />
<link href="css/ks.css" rel="stylesheet" type="text/css" />
</head>

<body>



<div id="head_k">
<div id="head_n" class="yy" >
<?php include("./zj/head.php"); /////写 ?>
</div>
</div>



<div id="all" class="yy">




<div id="ks_zt">

<div id="ks_left">




<?php
$result = mysql_query("SELECT * FROM ".$b_qz."_dt where tx='单选' and adm='".$_SESSION['id']."'  " );/// DESC 
 if (mysql_num_rows($result) != 0)
{?>

<br />
<h3>　单项选择</h3>
<hr>
<?php } ?>
<?php

while($row = mysql_fetch_array($result))
{
$i++;
echo "<div id=ks_kt >";
echo "<a href=./ks_ks2.php?id=".$row['id']."&i=".$i." >";
echo "<em class=ks_da >".$i."</em>";/////$wen[$ii]
echo "<em class=ks_kt >";
if($row['d']==''){echo "未答";}else{echo $row['d']; };
echo "</em>";
echo "</a>";
echo "</div>";
}
$i=0;
?>

<div class="clear"></div>




<?php
$result = mysql_query("SELECT * FROM ".$b_qz."_dt where tx='多选' and adm='".$_SESSION['id']."' and ksnr='".$_SESSION['ksnr']."' " );/// DESC 
 if (mysql_num_rows($result) != 0)
{?>

<br />
<h3>　多项选择</h3>
<hr>
<?php } ?>

<?php

while($row = mysql_fetch_array($result))
{
$i++;
echo "<div id=ks_kt >";
echo "<a href=./ks_ks2.php?id=".$row['id']."&i=".$i." >";
echo "<em class=ks_da >".$i."</em>";/////$wen[$ii]
echo "<em class=ks_kt >";
if($row['d']==''){echo "未答";}else{echo $row['d']; };
echo "</em>";
echo "</a>";
echo "</div>";
}
$i=0;

?>

<div class="clear"></div>



<?php
$result = mysql_query("SELECT * FROM ".$b_qz."_dt where tx='判断' and adm='".$_SESSION['id']."' and ksnr='".$_SESSION['ksnr']."' " );/// DESC 
 if (mysql_num_rows($result) != 0)
{?>

<br />
<h3>　判断</h3>
<hr>

<?php } ?>


<?php

$result = mysql_query("SELECT * FROM ".$b_qz."_dt where tx='判断' and adm='".$_SESSION['id']."' and ksnr='".$_SESSION['ksnr']."' " );/// DESC 
while($row = mysql_fetch_array($result))
{
$i++;
echo "<div id=ks_kt >";
echo "<a href=./ks_ks2.php?id=".$row['id']."&i=".$i." >";
echo "<em class=ks_da >".$i."</em>";/////$wen[$ii]
echo "<em class=ks_kt >";
if($row['d']==''){echo "未答";}else{echo $row['d']; };
echo "</em>";
echo "</a>";
echo "</div>";
}
$i=0;

?>

<div class="clear"></div>





</div><!--enc ks_left-->


<div id="ks_right"><?php include("./zj/ks_xx.php"); /////写 ?></div>

</div><!--enc ks_right-->





</div><!--enc all-->




<div id="foot_k">
<div id="foot_n" class="yy" >
<?php include("./zj/foot.php"); /////写 ?>
</div>
</div>




</body>
</html>



<?php include("./sql/close.php"); /////写?>