Apache/php

Michael Powell nightrecon at verizon.net
Thu Feb 12 04:38:28 PST 2009


Fbsd1 wrote:

> I have php code on home page to count how many times it is accessed from
> the internet. Problem is pages deeper in website can jump back direct to
> home page and this again gets counted.
> 
> Is there any way to give the php counter routine intelligent so it will
> bypass bumping the counter on accesses coming from pages in the site?
> 
[snip]

Just a very generic suggestion: Use session. If a session has not been 
established count the visit, set a session cookie and then whenever a 
jumpback happens check for session cookie. If there is a session cookie then 
don't increment. 

This is a portion of how most simple login pages function. Plenty of code 
samples and examples around the net that you can lift and get ideas. Just 
look for PHP "Login" pages.

Probably better and easier ways, but this is what jumps out first. 

-Mike






More information about the freebsd-questions mailing list