hi i want to create a php and check cookies if they are enabled or disabled then if enables i want to proceed to this code
<?php
$dir = "img";
$file = "counter.txt";
$cookie_name = "my_cookie_name";
$cookie_value = "my_cookie_value";
$cookie_life = "900";
if(!file_exists("$file"))
{
$fp=fopen("$file","a");
fputs($fp,"0");
fclose($fp);
}
$alt = 'alt=""';
$fp=fopen($file,"r+");
$hits=fgets($fp,10);
if(!isset($_COOKIE["$cookie_name"]))
{
$hits++;
fseek($fp,0);
fputs($fp,$hits);
setcookie($cookie_name, $cookie_value, time()+$cookie_life, "");
}
fclose($fp);
echo $hits;
?>
as you can see i have the counter.But i want to echo a message if cookies disabled and dont count +1 in the counter. What changes should i make?