Hello,
I want record the visitors ip address and how many time they access my website
but the problem that if the visitor behind firewall, so all I'll get a hundreds of visits from the same IP address
so I thought about using cookie ,
first I'll search for my cookie and if found, it add 1 to the counter
otherwise it create a new cookie
but for some reason the code not working, it always create a new cookie!!
is this the right way to do it? Thanks for your HELP

<?php


if(isset($_COOKIE['info']))
  {
  $cookieValue = $_COOKIE['info'];
  $query =	"update cookie
                    set count = count +1
                    where cookie_name='$cookieValue';";
  $result = shoot_query($query);
  }
else
  {
  $ip = getenv("REMOTE_ADDR");
  $expireDate = time()+3600*24*365*10; //year
  $cookieValue = uniqid (rand(),true);
  $cookieValue = str_replace(".", "", "$cookieValue");
  setcookie(info, $cookieValue, $expireDate);

  $query =	"INSERT INTO cookie (count, cookie_name, ip_address, date) VALUES
  		 	(1, '$cookieValue', '$ip', CURRENT_TIMESTAMP());";
  $result = shoot_query($query);
  }


?>

Hello,
I want record the visitors ip address and how many time they access my website
but the problem that if the visitor behind firewall, so all I'll get a hundreds of visits from the same IP address
so I thought about using cookie ,
first I'll search for my cookie and if found, it add 1 to the counter
otherwise it create a new cookie
but for some reason the code not working, it always create a new cookie!!
is this the right way to do it? Thanks for your HELP

<?php


if(isset($_COOKIE['info']))
  {
  $cookieValue = $_COOKIE['info'];
  $query =	"update cookie
                    set count = count +1
                    where cookie_name='$cookieValue';";
  $result = shoot_query($query);
  }
else
  {
  $ip = getenv("REMOTE_ADDR");
  $expireDate = time()+3600*24*365*10; //year
  $cookieValue = uniqid (rand(),true);
  $cookieValue = str_replace(".", "", "$cookieValue");
  setcookie(info, $cookieValue, $expireDate);

  $query =	"INSERT INTO cookie (count, cookie_name, ip_address, date) VALUES
  		 	(1, '$cookieValue', '$ip', CURRENT_TIMESTAMP());";
  $result = shoot_query($query);
  }


?>
setcookie("info", $cookieValue, $expireDate);

your cookie is not named with the string "info" so it never finds it.

yes you're right thanks
but it behave different between Firefox and internet Explorer
in Firefox it alwayes creates new one but when I view the cookie information it's not there
do you have any idea why??

try refreshing because php is server side so browsers should not be an issue.