1

hi all,
I am a new learner of php. I m currently working on my 1st php project.project is all about a website development.The site is still underdevelopment. I want to include counter in m website in order to know the number of visitors.I am continuously searching for a snippet.Please help!!

Edited by maunica: n/a

5
Contributors
6
Replies
7
Views
7 Years
Discussion Span
Last Post by hellojohnatan
1

hi all,
I am a new learner of php. I m currently working on my 1st php project.project is all about a website development.The site is still underdevelopment. I want to include counter in m website in order to know the number of visitors.I am continuously searching for a snippet.Please help!!

Sorry! No snippets here, but you will need two things:
The PHP connection handling ;
http://us3.php.net/manual/en/features.connection-handling.php

...and a database to be incremented with each connect.

1

Another possibility: If your pages are all dynamic pages pulled from content stored in a database, add a "hits" field to the table where you store the page content. Then every time a page is requested, increment the number in that field for that page. You will know how many times each page was hit, and you can easily do a query to total those hits (SUM) for a total visits number. Of course, this approach falls apart if not all your pages can be tracked that way.

0

By php user counter you mean.. You have registered users on your site..

you want to count the number of registered logged in users
or
you want to count the number of just normal visitors ?

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.