Cookies
Posted: Sun Jun 16, 2024 10:42 am
Some years ago I wanted to add visitor counters to my website Home page. I also wanted to avoid counting my own visits, and returns to the Home page from other pages. I ended up with the Extension, PHP Counter7 - shown below. I recently noticed an error message appearing when starting my website, which I eventually corrected by editing PHP Counter7 using Extension Builder for WYSIWYG Web Builder, and it now works fine.
The Extension produces the inserted HTML code at Start of Page shown below.
I am obviously using a Cookie named DONCHECK, but I have no idea where to find it to see what it contains.
I also cannot remember where I obtained the basis of PHP Counter7, and cannot find any Help file.
I Googled 'Cookies' 'till I was blue in the face but could not really find anything that tells me WHERE to find DONCHECK, so any suggestions would be very appreciated.
------------------
<?php
$revisit = "No";
//check if first visit
if(isset($_COOKIE["first"]))
{
$revisit = "Yes" ;
$play = " " ;
}
else
{
$cookie_name = "first";
$cookie_value = "XX";
setcookie($cookie_name, $cookie_value);
$play = "autoplay" ;
}
//check if MY computer
$cookie_name = "DONCHECK";
$user = " ";
if(isset($_COOKIE[$cookie_name]))
{
$user = $_COOKIE[$cookie_name];
}
// get the visit count, and update if first visit and NOT on my computer
$file = fopen("Counter.txt", 'r');
$data = fread($file, filesize("Counter.txt"));
fclose($file);
if ($data !== false)
{
$hits = intval($data);
if ($user != "Don3" && $revisit != "Yes")
{
$hits++;
$file = fopen("Counter.txt", 'w');
flock($file, LOCK_EX);
fwrite($file, $hits);
flock($file, LOCK_UN);
fclose($file);
}
}
?>
----------------
The Extension produces the inserted HTML code at Start of Page shown below.
I am obviously using a Cookie named DONCHECK, but I have no idea where to find it to see what it contains.
I also cannot remember where I obtained the basis of PHP Counter7, and cannot find any Help file.
I Googled 'Cookies' 'till I was blue in the face but could not really find anything that tells me WHERE to find DONCHECK, so any suggestions would be very appreciated.
------------------
<?php
$revisit = "No";
//check if first visit
if(isset($_COOKIE["first"]))
{
$revisit = "Yes" ;
$play = " " ;
}
else
{
$cookie_name = "first";
$cookie_value = "XX";
setcookie($cookie_name, $cookie_value);
$play = "autoplay" ;
}
//check if MY computer
$cookie_name = "DONCHECK";
$user = " ";
if(isset($_COOKIE[$cookie_name]))
{
$user = $_COOKIE[$cookie_name];
}
// get the visit count, and update if first visit and NOT on my computer
$file = fopen("Counter.txt", 'r');
$data = fread($file, filesize("Counter.txt"));
fclose($file);
if ($data !== false)
{
$hits = intval($data);
if ($user != "Don3" && $revisit != "Yes")
{
$hits++;
$file = fopen("Counter.txt", 'w');
flock($file, LOCK_EX);
fwrite($file, $hits);
flock($file, LOCK_UN);
fclose($file);
}
}
?>
----------------