<?
//-----------------------------------------------------------------------------
//    ID002同学录 单班级 (PHP & MySQL) 1.0 标准版
//-----------------------------------------------------------------------------
//    Copyright(C) aNErG, 2003. All rights reserved
//
//    技术支持 http://anerg.126.com
//-----------------------------------------------------------------------------
//    本软件对个人完全免费使用
//
//    如用于商业用途,您必须与我联系并支付RMB ￥20
//-----------------------------------------------------------------------------
require ('function.php');
include ('conn.php');
if($HTTP_COOKIE_VARS["class_username"])
{
$cname=$HTTP_COOKIE_VARS["class_username"];
$query="select userpwd from classuser where username='$cname'";
$result=mysql_db_query("$dbname",$query);
$r=mysql_fetch_array($result);
$userpwd=$r["userpwd"];
if($HTTP_COOKIE_VARS["class_userpwd"]==$userpwd)
 { 
   setcookie("class_username",$cname,time()+650);
   setcookie("class_userpwd",$userpwd,time()+650);
   $ctime=date("U");
   $cid=encrypt($cname);
   $query="DELETE FROM classcookie where ctime+600<'$ctime'";
   $result=mysql_db_query("$dbname",$query);
   	 $query="select count(*) from classcookie where cname='$cname'";
     $result=mysql_db_query("$dbname",$query);
	 $arr=mysql_fetch_array($result);
	 $num=$arr["count(*)"];
	 if($num==0){
	  $query="INSERT INTO classcookie VALUES('$cid','$cname','$ctime')";
      $result=mysql_db_query("$dbname",$query);}else{
   $query="update classcookie set cid='$cid',cname='$cname',ctime='$ctime' where cname='$cname'";
   $result=mysql_db_query("$dbname",$query);}
   
 if($result) {echo "$cid $cname $ctime";}
}
}
?>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<link href="css.css" rel="stylesheet" type="text/css">
<meta http-equiv=Refresh content="120">
</head>


 
