Selam, jquary beğeni sistemi ekledim siteme ajax.php de cookies kontrol ettiriyorum ama işe yaramıyor nerde hata yapıyorum acaba
<?php
if(isset($_POST)){
extract($_POST);
if ( $_COOKIE["oh_{$item}"] )
{
}
else
{
//check if item liked or disliked ??
($option) ? $like = 1 : $dislike = 1;
// what to update ?
($like) ? $action = "likes" : $action = "dislikes";
// check if entry allready exists ??
$exist = mysql_num_rows(mysql_query("select * from ".$dbtable." where `id` =".$item));
if(!$exist){
}else{
mysql_query("update ".$dbtable." set ".$action." = ".$action." +1 where `id` = ".$item);
setcookie("oh_{$item}", true, time() + (60 * 60 * 24 * 30) );
}
// get review count
$count = mysql_fetch_assoc(mysql_query("select * from ".$dbtable." where `id` = ".$item));
echo json_encode($count);
}
}
?> <?php
ob_start();
session_start();
$session_item=$_SESSION["oh_".$item];
if(!isset($session_item) && !$session_item ){
if($_POST){
extract($_POST);
($option) ? $like = 1 : $dislike = 1;
($like) ? $action = "likes" : $action = "dislikes";
$exist=mysql_num_rows(mysql_query("select * from ".$dbtable." where `id` =".$item));
if($exist==0){
mysql_query("update ".$dbtable." set ".$action." = ".$action." +1 where `id` = ".$item);
$_SESSION["oh_".$item]=$item;
}
$count=mysql_num_rows(mysql_query("select * from ".$dbtable." where `id` = ".$item));
echo json_encode($count);
}else{
header("Location:index.php");
exit();
}
}else{
header("Location:index.php");
exit();
}
?>