Jump to content

annoying php thing...


phpSensei

Recommended Posts

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.

Link to comment
Share on other sites

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).

Link to comment
Share on other sites

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?

Link to comment
Share on other sites

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.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.