Jump to content

[SOLVED] Creating "turns" to users


Gath

Recommended Posts

Hi.

 

What i want is to have a way for users to get a certain amount of "turns" every certain time (let's say 10 minutes = 1 turn). What are my options? So far i planned a way that checks the last time the user saw a page, and gives him the amount of "turns" depending on the time it passed.

But i'm wondering if there might be other/better ideas.

I could set somekind of cronjob, but i dont like that idea mutch. I'd rather have it update independently then in "batch".

 

So, if you have any ideas that you'd like to share... i'm listening  :)

Link to comment
https://forums.phpfreaks.com/topic/67609-solved-creating-turns-to-users/
Share on other sites

Hi.

 

What i want is to have a way for users to get a certain amount of "turns" every certain time (let's say 10 minutes = 1 turn). What are my options? So far i planned a way that checks the last time the user saw a page, and gives him the amount of "turns" depending on the time it passed.

But i'm wondering if there might be other/better ideas.

I could set somekind of cronjob, but i dont like that idea mutch. I'd rather have it update independently then in "batch".

 

So, if you have any ideas that you'd like to share... i'm listening  :)

Those are your two options. Cron really is the way to go though.

Cron would be easier on your system. do you really wanna run an sql statement every time a person loads a page just to see if a certain amount of time has passed?  That would be less productive than a single cron job ever so often.

Cron would be easier on your system. do you really wanna run an sql statement every time a person loads a page just to see if a certain amount of time has passed?  That would be less productive than a single cron job ever so often.

 

I'd prefer not to have cron because every place i knew had a cron, and created similar "turns", would lag down everytime the turn would take place. Not very important when one has a small amount of users, but becomes kind of a drag when the community becomes big.

Also, since i still have to make around 2-3 sql query per page, so, having some code checking the time isnt that big of a deal.

 

But... i'll try both ways :) Then i'll check how it goes with one and hte other  ;)

Thanks for the input.

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.