Porkie Posted May 19, 2009 Share Posted May 19, 2009 im sort off struggling, i need a piece of code that i can add to my web pages which counts the number of hits and displays them on a different page, is this simple or difficult ? cheers in advance Link to comment https://forums.phpfreaks.com/topic/158766-hits-meter/ Share on other sites More sharing options...
jackpf Posted May 19, 2009 Share Posted May 19, 2009 Just make a file that increments some field in a database. Then include it on every page. You may also want to set a cookie or something to make sure people aren't just holding down f5. Link to comment https://forums.phpfreaks.com/topic/158766-hits-meter/#findComment-837381 Share on other sites More sharing options...
Ken2k7 Posted May 19, 2009 Share Posted May 19, 2009 Clicky Link to comment https://forums.phpfreaks.com/topic/158766-hits-meter/#findComment-837384 Share on other sites More sharing options...
plznty Posted May 25, 2009 Share Posted May 25, 2009 make a file for example hits.txt then make it so that it ads +1 to hits.txt every time the page is opened. Using PHP math, then on the page you want it viewed php include hits.txt. I hope it helped. Link to comment https://forums.phpfreaks.com/topic/158766-hits-meter/#findComment-841446 Share on other sites More sharing options...
corbin Posted May 26, 2009 Share Posted May 26, 2009 make a file for example hits.txt then make it so that it ads +1 to hits.txt every time the page is opened. Using PHP math, then on the page you want it viewed php include hits.txt. I hope it helped. File locking would quickly become an issue if his site has any decently sized amount of traffic. Link to comment https://forums.phpfreaks.com/topic/158766-hits-meter/#findComment-842383 Share on other sites More sharing options...
Ken2k7 Posted May 26, 2009 Share Posted May 26, 2009 Can't you use Apache logs? Link to comment https://forums.phpfreaks.com/topic/158766-hits-meter/#findComment-842385 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.