phpSensei Posted August 23, 2007 Share Posted August 23, 2007 I looked through every single little page and forum files, and i still don't know how to show how many guests are viewing your site. how does it damn thing work.. I keep thinking its all about registered an ip. Please, help. Quote Link to comment https://forums.phpfreaks.com/topic/66384-annoying-php-thing/ Share on other sites More sharing options...
Caesar Posted August 23, 2007 Share Posted August 23, 2007 Use MYSQL. Create a sessions table and update it every time the page is viewed. Quote Link to comment https://forums.phpfreaks.com/topic/66384-annoying-php-thing/#findComment-332227 Share on other sites More sharing options...
phpSensei Posted August 23, 2007 Author Share Posted August 23, 2007 Edit: what do you mean sessions table? Quote Link to comment https://forums.phpfreaks.com/topic/66384-annoying-php-thing/#findComment-332230 Share on other sites More sharing options...
akitchin Posted August 23, 2007 Share Posted August 23, 2007 update people's last action time in a table, and pull everyone whose last action was, for example, less than 5 minutes ago. consider a page view an "action." if you want to save on some resources, set a minimum time interval between table updates, otherwise you'll be running an UPDATE on every single page visit for every single user. Quote Link to comment https://forums.phpfreaks.com/topic/66384-annoying-php-thing/#findComment-332244 Share on other sites More sharing options...
phpSensei Posted August 23, 2007 Author Share Posted August 23, 2007 Can you show me an example of the interval... Quote Link to comment https://forums.phpfreaks.com/topic/66384-annoying-php-thing/#findComment-332247 Share on other sites More sharing options...
phpSensei Posted August 23, 2007 Author Share Posted August 23, 2007 K i understand now... I insert the ip's registered in a session table, then 5 minutes later, I re-run the script to see how many sessions are left. Then I update the table again. Or you can just post the example if your kind enough. Quote Link to comment https://forums.phpfreaks.com/topic/66384-annoying-php-thing/#findComment-332250 Share on other sites More sharing options...
akitchin Posted August 23, 2007 Share Posted August 23, 2007 i'm going to link you to four threads that cover exactly this topic: http://www.phpfreaks.com/forums/index.php/topic,101955.0.html http://www.phpfreaks.com/forums/index.php/topic,148226.0.html http://www.phpfreaks.com/forums/index.php/topic,95397.0.html http://www.phpfreaks.com/forums/index.php/topic,100488.0.html i'm not going to post an example, simply because there's plenty of code and discussion in these threads (more than enough to get you on your way). Quote Link to comment https://forums.phpfreaks.com/topic/66384-annoying-php-thing/#findComment-332258 Share on other sites More sharing options...
phpSensei Posted August 23, 2007 Author Share Posted August 23, 2007 thankyou, for your help. Quote Link to comment https://forums.phpfreaks.com/topic/66384-annoying-php-thing/#findComment-332261 Share on other sites More sharing options...
phpSensei Posted August 23, 2007 Author Share Posted August 23, 2007 I understood everthing and I even added some of my own stuff... One thing I don't understand. How would you attempt to do this with an ip adress. I you register the ip then update the mysql database, then you count the number of ip registered within the last 5 minutes, then 5 minutes later, how do you delete all the previous record at once? Quote Link to comment https://forums.phpfreaks.com/topic/66384-annoying-php-thing/#findComment-332284 Share on other sites More sharing options...
akitchin Posted August 23, 2007 Share Posted August 23, 2007 i'm not sure why you'd feel the need to delete them after 5 minutes, but: DELETE FROM some_table WHERE timestamp < DATE_SUB(NOW(), INTERVAL 5 MINUTE) Quote Link to comment https://forums.phpfreaks.com/topic/66384-annoying-php-thing/#findComment-332291 Share on other sites More sharing options...
phpSensei Posted August 23, 2007 Author Share Posted August 23, 2007 See what I want to do, is register all the ip's that are viewing my site, then set the UNIX TIME thing, then count the number of registered ip's that keep coming in within 5 minutes, then if 5 minutes is passed, the time is reseted and the previous ip's are deleted. Quote Link to comment https://forums.phpfreaks.com/topic/66384-annoying-php-thing/#findComment-332299 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.