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? Quote Link to comment 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. Quote Link to comment 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 Quote Link to comment 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? Quote Link to comment 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. Quote Link to comment 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.