<?php include("../conn.php") ?>
<? 
$get_id=$_GET["id"];
$sql="select  *  from  classtable   where  id=".$get_id;
$rs=$conn->execute($sql);
$nnn=0;
$flag=0;
if (!$rs->EOF)
{
  $read_status=$rs->fields["course_sele_class"];
  $read_classname=$rs->fields["classname"];
}
$rs->close;
if ($read_status==0)
  {
    $sql="update classtable set course_sele_class=1 ";
	$sql=$sql."  where  id=".$get_id;
    $rs=$conn->execute($sql);
	$rs->close;
	$flag=1;
  }
else
  {
    $sql="update classtable set course_sele_class=0 ";
	$sql=$sql."  where  id=".$get_id;
    $rs=$conn->execute($sql);
	$rs->close;
	$flag=1;
}
$flag_value="999";
$sql="select *  from examinfo  where  flag='".$flag_value."'";
$rs=$conn->execute($sql);
$read_mode=$rs->fields["exam_mode"];
$rs->close;
if  (($read_mode==1) and ($read_classname=='Internet'))
{
	$sql="update classtable set course_sele_class=0";
	$sql=$sql."  where  id=".$get_id;
    $rs=$conn->execute($sql);
	$rs->close;
	$flag=2;
}
if  (($read_mode==0) and ($read_classname!='Internet'))
{
	$sql="update classtable set course_sele_class=0";
	$sql=$sql."  where  id=".$get_id;
    $rs=$conn->execute($sql);
	$rs->close;
	$flag=3;
}
$conn->close;
if ($flag==1)
 {
  echo "1".$read_classname;
 }
 else if ($flag==2)
 {
  echo "2".$read_classname;  
 }
 else if ($flag==3)
 {
  echo "3".$read_classname;  
 }
 else 
 {
  echo "0";
 } 
?>

