1

I have a problem with my code. I am validating the track of views in my page and I tested it using 2 different PC and the $_SERVER['REMOTE_ADDR'] are the same.

I don't know why they are the same.
I need to track how many visitor visit my page everyday. Can you suggest me a best way to do this?

8
  • 2
    Are your two different computers part of the same network? If so it's common to have 1 or just a few external IP addresses. Commented Mar 16, 2015 at 9:28
  • Because, most of computers do not have their own global IP(just local in their network), but they have one IP of their provider(as usually) Commented Mar 16, 2015 at 9:29
  • ISPs and routers usually use something called DHCP with IPv4 which basically just assigns a single IP address to a household and then the router then directs it to the correct computer on your household network. IPv6 has a very large amount of combinations and as such DHCP is rarely used because it is not necessary. Two computers on the same network will both have the same public IPv4 address. Commented Mar 16, 2015 at 9:30
  • so can you suggest me another way to track the visitor in my page? Commented Mar 16, 2015 at 9:30
  • 1
    You could simply use sessions and then create a function to increment 1 for every new visitor. There is many ways of doing this, if you don't want to code anything just use google analysis. Commented Mar 16, 2015 at 9:32

1 Answer 1

2

Umm are both computers on same LAN, heaving common public ip address?? you can use cookies to track visitors

Sign up to request clarification or add additional context in comments.

5 Comments

What is cookies are disabled ?
umm you should be using cookies, session and ip address to make it more reliable...
But you won't be able to track visitors if they have cookies disabled in they browser
make an algorithm like: if ip = same, cookie not found, session not found (new user, set cookie and session) if ip = new, cookie = not found, session = not found (new user, set cookie and session) if ip = same, cookie = found, session = found (old user) if ip = same, cookie = not found, session = found (old user) and so on...
you cannot rely only on ip, or cookies or sessions... but a mixture can be made reliable...

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.