<?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;
	 }

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


	 $result = mysql_query("SELECT * FROM ".$b_qz."_ks where ksnr ='".$_POST['nr']."' and sfz ='".$ksxx[2]."' ");
	 if (mysql_num_rows($result) != 0 or $ksxx[2]=='')//检查库里是否有这个用户名
	 {
     echo "<script>alert('身份证".$ksxx[2]."重复！');</script>";
	 }else{
mysql_query("INSERT INTO ".$b_qz."_ks (name, dw, sfz, tel, ksnr) VALUES ('".$ksxx[0]."','".$ksxx[1]."','".$ksxx[2]."', '".$ksxx[3]."','".$_POST['nr']."')");
	 }


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

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;
	 }

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


	 $result = mysql_query("SELECT * FROM ".$b_qz."_ks where ksnr ='".$_POST['nr']."' and sfz ='".$_POST['c']."' ");
	 if (mysql_num_rows($result) != 0 or $_POST['c']=='')//检查库里是否有这个用户名
	 {
     echo "<script>alert('身份证".$_POST['c']."重复！');</script>";
	 echo "<meta http-equiv=refresh content=0.1;url=".$llym." >";
	 exit;
	 }else{
mysql_query("INSERT INTO ".$b_qz."_ks (name, dw, sfz, tel, ksnr) VALUES ('".$_POST['a']."','".$_POST['b']."','".$_POST['c']."', '".$_POST['d']."','".$_POST['nr']."')");
	 }

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

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 include("../sql/close.php"); /////写?>
