Repeat Visitors See Content Change With PHP
Sometimes you want to say one thing when a person first
visits a page on your web site, and a different thing when
they come back or when they visit another page.
If they come back a third or a tenth time, maybe you want to
say something different still.
With today's PHP script, it's easy to set up and do.
The PHP script determines the number of times a certain web
page or group of web pages have been visited by individual
users, as determined by the value of a cookie. It then
prints content depending on that number of visits.
The number of visits can be incremented page-by-page or can
be cumulative over several or many pages.
A customization in the PHP script specifies whether the
cookie shall apply only to pages in the directory where the
current web page is at or apply site-wide. To narrow things
down even further, to specific pages or groups of pages, a
unique cookie name can be specified for the page or group.
However the number of visits is set up for counting, the
content to be printed is determined by that count.
The content printed with the PHP can be a small portion of
the page -- a sentence, an image, a link, a price -- or it
can be a large portion. The content printed with the PHP can
even be the entire page.
Extensive customization information is within the source
code of the PHP script itself.
Each page to be influenced by the visit count needs the PHP
script.
The script must be first in the web page source code file,
before any other characters or spaces or blank lines. If it
is not first in the file, it can not set the visit count
cookie.
When installed on your web page, site visitors will see
content depending on how many times they have visited the
page or other coded pages of your web site.
Question:
Did you find this article interesting and understandable? How can it be improved?
Your response is anonymous.
When done typing, click anywhere outside the box. [more info]
Will Bontrager
©2007 Bontrager Connection, LLC Bontrager Connection, LLC
Please note:
Articles on this website are presented "as is". However -
If you have a question about a CGI script, HTML, CSS, PHP, or JavaScript
Ask one of our Experts and you'll have your answer!
Click here for details.