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!!

Recommended Answers

All 6 Replies

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.

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.

Thank you soo much for help..

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 ?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.