PseudoEvolution Posted July 5, 2008 Share Posted July 5, 2008 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 More sharing options...
MasterACE14 Posted July 6, 2008 Share Posted July 6, 2008 whats to say crons aren't efficient or secure? I've never had any problems with crons with any of my games before. Link to comment https://forums.phpfreaks.com/topic/113393-timers-for-a-large-number-of-users/#findComment-582618 Share on other sites More sharing options...
dannyb785 Posted July 6, 2008 Share Posted July 6, 2008 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 Link to comment https://forums.phpfreaks.com/topic/113393-timers-for-a-large-number-of-users/#findComment-582673 Share on other sites More sharing options...
PseudoEvolution Posted July 6, 2008 Author Share Posted July 6, 2008 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? Link to comment https://forums.phpfreaks.com/topic/113393-timers-for-a-large-number-of-users/#findComment-582970 Share on other sites More sharing options...
GingerRobot Posted July 6, 2008 Share Posted July 6, 2008 If possible, just place it outside the document root. I would imagine that if you're able to set up a cron job on your server/hosting you should have access above the document root. Link to comment https://forums.phpfreaks.com/topic/113393-timers-for-a-large-number-of-users/#findComment-583061 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.