Jump to content

Timers for a large number of users.


Recommended Posts

I'm creating a (yet another) PHP MMORPG and it's coming along very smoothly; however, I am unsure what kind of timer methods I would use for giving user's money/stats.

 

If you need an example, let's say I want to give everyone $500 every 30 minutes. What's the best way to go about doing this? The only way I know is to make a cronjob to run a php script, but this can't be efficient or secure.

 

Any ideas?

Link to comment
https://forums.phpfreaks.com/topic/113393-timers-for-a-large-number-of-users/
Share on other sites

yea, just put some sort of identifying measures to make sure users don't try to run the script(if they know it exists). something like if you know it's supposed to run every 30 minutes, do a check to make sure that when it's execited that it really is 2:30 or 2:00 and so on. otherwise, there's no reason why not to use a cronjob

Thanks guys.

 

I guess I could use a CJ. I was worried that other people would run it (or even a bot), but it wouldn't be that hard to protect.

 

Is it possible to pass variables when running a script? If so, I could just make a 10 digit ID or something.

 

Like /updatescript.php?auth=c732s9kw25

 

and only accept IPs from localhost maybe?

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.