Click to See Complete Forum and Search --> : my hit counter
ubunreal69
Mar 21st, 2002, 09:50 PM
i have my page designed in modules and the page displayed being passed through the address string (values). anbyway, i dont know how to explain that part clearly but its noyt really neccessary for now.
the thing i want to ask is, should i have it only tally one to the counter on the first time the user views the first page, or session ? or even use a cookie and count the user every week or something.
any comments ?
Aurilus
Mar 22nd, 2002, 07:40 PM
I'd say have a counter for each page (ie store seperate values for each page, not just one big number) and have it incremented each time the page is viewed.. this is the easiest way and will give you some idea of how many ppl (both new and repeat visitors) visit your page. Cookies don't always work in all circumstances as some people disable them and this can screw up your site if you rely on them.
ubunreal69
Mar 23rd, 2002, 03:26 AM
ok, thats a good idea actually. should i store their IP's as well ??
Aurilus
Mar 23rd, 2002, 06:25 PM
Not unless you have to. The only reason I can think of storing IPs would be to track repeated users, but many ISPs actually assign a dynamic (different) IP each time to dial-up users, so this method of tracking won't always work.
NewHelp4Me
Apr 2nd, 2002, 03:41 PM
How would you create the Hit counter? How do you retrieve a variable from a database file (text file). ?Extract the number from a text file, add 1, then save back to text file? I'm new to PHP. If you want to visit my site @ www.nada.d2g.com\junk.php this is bout the only thing i have made in php so far.
ubunreal69
Apr 2nd, 2002, 05:40 PM
when i get home i'll post the code 4 u, thing is that now it doesnt appear to be working, but i'll fix it 4 u :D
ubunreal69
Apr 3rd, 2002, 03:25 AM
<?PHP
$link = mysql_connect("localhost", "root");
mysql_select_db("ubunreal");
$temp_page_count = mysql_result(mysql_query("SELECT count FROM counter"),0,"count");
$temp_page_count++;
mysql_query("UPDATE counter SET count=$temp_page_count");}
ECHO mysql_result(mysql_query("SELECT count FROM counter"),0,"count");
?>
there is the code i use, made it myself too :D anyway, it simply logs into a MySQL DB server and extracts the existing value in the cell, adds one to it then runs another query to replace the updated value, after that there is another query to get the resuly back out and display it to the HTML output.
need any more explanation then pls just ask ;)
ricmitch_uk
Apr 3rd, 2002, 10:43 AM
There's plenty of free counters out there that do all of the above and more.
Do a search on SourceForge (http://www.sourceforge.net) or on Google.
:)
Gimlin
Apr 3rd, 2002, 10:53 AM
Bah make it yourself its much more rewarding :)
ricmitch_uk
Apr 3rd, 2002, 11:20 AM
I do most of my code myself, but I do occasionally scarf bits from Open Source things.
ubunreal69
Apr 3rd, 2002, 05:27 PM
Bah make it yourself its much more rewarding :)couldnt agree more, thats why i try and do everything mysqlf before seeking other peoples code :)
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.