<?php
include_once("inc/config.php");
include_once("inc/ftbbsdbclass.php");
include_once("inc/publicfun.php");
include_once("conn.php");
include_once("checkuser.php");
if (checkuserlogin()=="N"){
   header("Location:userlogin.php?flag=Y");
}
$id=intval($_GET["id"]);
$postuser=$_POST['postuser'];

$sql="select * from ftbbs_favorites where clubuser_name='".get_cookie('username')."' and bbstitleid='".$id."'";
$rs=mysql_query($sql);
//$myrow = mysql_fetch_array($rs);
$numrows = mysql_num_rows($rs);
if ($numrows!=0){
   echo "<script language='javascript'>";
   echo "alert('你已经收藏过该贴子!');";
   echo "history.go(-1);";
   echo "</script>"; 
}
else{
  mysql_query("insert into ftbbs_favorites (clubuser_name,bbstitleid,typesign) values('".get_cookie('username')."',".$id.",0)");
  echo "<script language='javascript'>history.go(-1);</script>";
}
?>