hi...
I need some help from you...I wanna make web counter on my website,can you help me....coz I have already done with my counter but it doesn't works good...help me plizz
hi...
I need some help from you...I wanna make web counter on my website,can you help me....coz I have already done with my counter but it doesn't works good...help me plizz
Heres a way to do it in PHP, on every page you want to put this code:
And then on counter.php:PHP Code:<?php
include('counter.php');
?>
You'll find a file that's automatically created called "counter.txt", thats where the number of hits you got are. Also it can be the same person refreshing there page rapidly. So I can create it so it only counts for one person once a day if you want. But tell me if you do.PHP Code:<?php
function counter($file){
$fdata = fopen($file, 'w');
$data = file_get_contents($file);
$newData = $data+1;
fwrite($fdata, $newData);
fclose($fdata);
}
counter('counter.txt');
?>
You can also take a look at this witch isn't what you wanted. But:
http://www.dynamicdrive.com/forums/s...16&postcount=7
You can do it with db too.
Like when press to link, call function. Then get old count and make $newcount = $oldcount+1;
Only you will need is to update the count:
$result = mysql_query("UPDATE counter SET count = '$newcount' WHERE id = '$id'");
if you have question can ask ^^
hello... my question is ...
how to know how many visitors already visited in my site....
tell me, plz help me
ramaraju,
Please start a new thread to ask your question.
The last reply in this thread was almost five years ago - there is almost never an acceptable reason to post in such an old conversation.
Read the Forum Rules before starting your thread.
This thread is also a good place to learn about the rules here on DynamicDrive.
If you are looking for a complete script that you can use, post in the Looking for such a script or service forum (or, read Nile's reply, above).
If you are trying to write one yourself, post in the PHP forum.
Note that it is not possible to determine how many visitors you have already had: any script will be able to record only subsequent visits.Originally Posted by ramaraju
Also,
Your question is unclear.
Please provide more information, and be as specific as possible.
- What do you want to accomplish?
- What have you already tried?
- What problems did you encounter?
Please be sure that you have included all relevant code and/or a link to the page in question.
You might also consider making a reduced test case using an online tool like jsfiddle
Last edited by traq; 05-28-2013 at 05:13 AM.
Adrian ~ facebook | gist/github
['66.215.156.37','208.75.149.97'] // ip,ip array!
"Take that sticker *off* your hat; you look stupid" --Wil Wheaton
Bookmarks