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

<?php
if ($_GET['tjx']=="tjx")
{
	 if ($_POST['nr']=='')//检查库里是否有这个用户名
	 {
	 echo "<script>alert('填写考试名！');</script>";
	 echo "<meta http-equiv=refresh content=0.1;url=".$llym." >";
	 exit;
	 }
	 
	 if ($_POST['tx']=='')//检查库里是否有这个用户名
	 {
	 echo "<script>alert('题形，没写！');</script>";
	 echo "<meta http-equiv=refresh content=0.1;url=".$llym." >";
	 exit;
	 }

//////////////////////////////////////////////////////////////////////////////
$szsz = explode("\r\n",$_POST['tk']); 
for($index=0;$index<count($szsz);$index++) 
{ 
$ksxx = explode(",",$szsz[$index]); /////用带豆号再做区分，

	 $result = mysql_query("SELECT * FROM ".$b_qz."_tk where tk_name ='".$_POST['nr']."' and tm ='".$ksxx[0]."' ");
	 if (mysql_num_rows($result) != 0 or $ksxx[0]=='')//检查库里是否有这个用户名
	 {
     echo "<script>alert('问题".$ksxx[0]."重复！');</script>";
	 }else{
mysql_query("INSERT INTO ".$b_qz."_tk (tm, a, b, c, d, ans, tk_name, tx) VALUES ('".$ksxx[0]."','".$ksxx[1]."','".$ksxx[2]."', '".$ksxx[3]."','".$ksxx[4]."','".$ksxx[5]."','".$_POST['nr']."','".$_POST['tx']."')");
	 }

}
//////////////////////////////////////////////////////////////////////////////

mysql_query("INSERT INTO ".$b_qz."_text (user, ip1, time1, dm, ting) VALUES ('".$_SESSION['user_1']."','".$iipp."','".$noww."', 'dr_ks','导入考生')");

echo "<script>alert('完成导入！');</script>";
echo "<meta http-equiv=refresh content=0.1;url=".$llym." >";
exit;
}
?>






<?php
if ($_GET['tj']=="tj")
{

	 if ($_POST['nr']=='')//检查库里是否有这个用户名
	 {
	 echo "<script>alert('填写考试名！');</script>";
	 echo "<meta http-equiv=refresh content=0.1;url=".$llym." >";
	 exit;
	 }
	 
	 if ($_POST['tx']=='')//检查库里是否有这个用户名
	 {
	 echo "<script>alert('题形，没写！');</script>";
	 echo "<meta http-equiv=refresh content=0.1;url=".$llym." >";
	 exit;
	 }

//////////////////////////////////////////////////////////////////////////////

	 $result = mysql_query("SELECT * FROM ".$b_qz."_tk where tk_name ='".$_POST['nr']."' and tm ='".$_POST['a']."' ");
	 if (mysql_num_rows($result) != 0 or $_POST['a']=='')//检查库里是否有这个用户名
	 {
     echo "<script>alert('问题".$ksxx[2]."重复！');</script>";
	 }else{
mysql_query("INSERT INTO ".$b_qz."_tk (tm, a, b, c, d, ans, tk_name, tx) VALUES ('".$_POST['a']."','".$_POST['b']."','".$_POST['c']."', '".$_POST['d']."','".$_POST['e']."','".$_POST['f']."','".$_POST['nr']."','".$_POST['tx']."')");
	 }

//////////////////////////////////////////////////////////////////////////////

mysql_query("INSERT INTO ".$b_qz."_text (user, ip1, time1, dm, ting) VALUES ('".$_SESSION['user_1']."','".$iipp."','".$noww."', '1_KT','独立题目录入')");

echo "<script>alert('成功录入一条！');</script>";
echo "<meta http-equiv=refresh content=0.1;url=".$llym." >";
exit;

}
?>









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