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

<?php
if($_GET['ts'])
{
$ts = $_GET['ts'];
}	 
else
{
$ts = 12;
}
if($_GET['ys'])
{
$ys = $ts*($_GET['ys']-1);
}	 
else
{
$ys = 0;
}
if($_GET[px]==''){
$px = "time1";
}
else{
$px = $_GET[px];
}
?>


<?php
if($_GET['se']=='se')
{
$_SESSION['tk_name'] = $_POST['tk_name'];
$_SESSION['tx_name'] = $_POST['tx_name'];
echo "<meta http-equiv=refresh content=0.1;url=".$llym." >";
exit;
}
?>


<!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" />
</head>

<body>



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



<div id="all" class="yy">
<?php include("./zj/kg_dh.php"); /////写 ?>

<br />
<p align="center">&nbsp;</p>


</hr>

<form action=?se=se method=post style="text-align:center">
<select name="tk_name" style="width:200px;  " ><option value="<?php echo $_SESSION['tk_name']; ?>"><?php echo $_SESSION['tk_name']; ?></option>
<option value=""></option>
<?php
$result = mysql_query("SELECT * FROM ".$b_qz."_tk_name ORDER BY id DESC " );/// DESC 
while($row = mysql_fetch_array($result))
{
echo "<option value=".$row['name']." >".$row['name']."</option>";
}
?>
</select>


<select name="tx_name"  >
<option value="<?php echo $_SESSION['tx_name']; ?>"><?php echo $_SESSION['tx_name']; ?>
<option value=""></option>
<option value="单选">单选</option>
<option value="多选">多选</option>
<option value="判断">判断</option>
</select>


<input style="width:200px; " type=submit class="inp" onClick=return value='查　询'　 confirm('确定！？') /></form>




<center>
<table style="text-align:center" >
<tr>
<td>　</td>
<td>ID</td>
<td>问题</td>
<td>A</td>
<td>B</td>
<td>C</td>
<td>D</td>
<td>答案</td>
<td>题形</td>
<td>-</td>
</tr>
<?php
$result = mysql_query("SELECT * FROM ".$b_qz."_tk where tk_name='".$_SESSION['tk_name']."' and tx='".$_SESSION['tx_name']."' ORDER BY id  DESC LIMIT ".$ys.",".$ts );/// DESC 
while($row = mysql_fetch_array($result))
{
echo "<tr>";
echo "<td>　</td>"; 
echo "<td><textarea style='width:55px; height:20px;'>".$row['id']."</textarea></td>";
echo "<td><textarea style='width:288px; height:20px;'>".$row['tm']."</textarea></td>";
echo "<td><textarea style='width:55px; height:20px;'>".$row['a']."</textarea></td>";
echo "<td><textarea style='width:55px; height:20px;'>".$row['b']."</textarea></td>";
echo "<td><textarea style='width:55px; height:20px;'>".$row['c']."</textarea></td>";
echo "<td><textarea style='width:55px; height:20px;'>".$row['d']."</textarea></td>";
echo "<td><textarea style='width:55px; height:20px;'>".$row['ans']."</textarea></td>";
echo "<td><textarea style='width:55px; height:20px;'>".$row['tx']."</textarea></td>";
echo "<td>[<a href=./run/kg_tkxx.php?sc=sc&id=".$row['id']." ";
  ?> onClick="return confirm('确认删除！？')"<?php	
echo " > 删 </a>]</td>";
echo "</tr>";
}
?>
</table>
</center>



<br />

<center>

<table border=0 align="center">
  <tr>
    <td><?php
$result_js = mysql_query("SELECT * FROM ".$b_qz."_tk where tk_name='".$_SESSION['tk_name']."' and tx='".$_SESSION['tx_name']."' ");
$num_js = mysql_num_rows($result_js);
$ys = ceil($num_js/$ts);
if($_GET['ys']<1 or $_GET['ys']=='') {$_GET['ys']=1;}

if($_GET['ys']>$ys and $ys > 1) {
echo "<meta http-equiv=refresh content=0.1;url=?ys=".$ys."&px=".$_GET[px]."&ts=".$_GET[ts].$so_get." >";
exit;//////////如果实际的页数比GET的页小，需跳回到，正常的页数！
}
echo "　记录".$num_js."条";
?></td>
    <td><?php
if($_GET['ys']==1) {
echo " 首页 ◁ ";
}else{
echo " <a href=?ys=1&px=".$_GET[px]."&ts=".$_GET[ts].$so_get." title=第1页 >最前</a> ";
echo " <a href=?ys=".($_GET['ys']-1)."&px=".$_GET[px]."&ts=".$_GET[ts].$so_get." title=向前翻页 >◀</a> ";
}
echo $_GET['ys'];
if($_GET['ys']==$ys) {
echo " ▷ 尾页 ";
}else{
echo " <a href=?ys=".($_GET['ys']+1)."&px=".$_GET[px]."&ts=".$_GET[ts].$so_get." title=向后翻页 >▶</a> ";
echo " <a href=?ys=".$ys."&px=".$_GET[px]."&ts=".$_GET[ts].$so_get." title=第".$ys."页 >最后</a> ";
}
?></td>
    <td><?php
$i = $_GET['ys'] - 4;
if($i<1) {$i=1;}
$ysx = $i + 7;
if($ysx>$ys) {$ysx = $ys;}

for ($i; $i<=$ysx; $i++)
{
if ($_GET['ys']!=$i)
echo " <a href=?ys=".$i."&fl=".$_GET[fl]."&ts=".$_GET[ts].$so_get." title=第".$i."页 >[ ".$i." ]</a> ";
else
echo "<b>[ ".$i." ]</b>";
}
?> </td>
    <td> </td>
    <td><?php if($_GET[ts]==36){echo "36条";}else{echo " <a href=?ys=".$_GET[ys]."&px=".$_GET[px]."&ts=36".$so_get." title=每页显示36条信息 >36条</a> ";} ?></td>
    <td>&nbsp;</td>
    <td><?php if($_GET[ts]==48){echo "48条";}else{echo " <a href=?ys=".$_GET[ys]."&px=".$_GET[px]."&ts=48".$so_get." title=每页显示48条信息 >48条</a> ";} ?></td>
    <td> </td>
  </tr>
</table>


</center>

<br />


</div>




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




</body>
</html>



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