Author Topic: [SOLVED] Basics to Tick  (Read 794 times)

Offline Jesterhead

  • Level 8
  • *
  • Posts: 41
  • Reputation: +1/-0
  • In Flames we trust!
    • View Profile
[SOLVED] Basics to Tick
« on: November 30, 2010, 01:03:57 PM »
Hello everyone,

I'm stuck again! Altough it's pretty fun to use PHP in a whole new way!

This time it's about a so called "tick" in the game, every x hours some code is processed.
I probably don't have to explain this to you guys!

Well, I've been searching around these forums, but couldn't really find the basic structure of such a tick system...
Mind helping me out once again? :)

Thank you!
« Last Edit: November 30, 2010, 05:02:51 PM by Jesterhead »

Offline Nox

  • Level 35
  • **
  • Posts: 767
  • Reputation: +12/-2
    • View Profile
Re: Basics to Tick
« Reply #1 on: November 30, 2010, 01:10:16 PM »
CRON / Just search this forum for CRON and you'll get tons of info about CRON or other usable similar systems
Meet us at an IRC irc.freenode.net #bbg as well
https://vimeo.com/36579366 (a must-watch) | Join BOINC - no longer a hype, but you can help never the less

Offline Jesterhead

  • Level 8
  • *
  • Posts: 41
  • Reputation: +1/-0
  • In Flames we trust!
    • View Profile
Re: Basics to Tick
« Reply #2 on: November 30, 2010, 01:42:30 PM »
Thank you, I had no idea that I needed to search for that term.

Now I checked my host and it supports cronjobs, it asks for a command to execute.
Can I simply do this?

Code: [Select]
www.myurl.com/cronjobs.php
or rather this?

Code: [Select]
include('cronjobs.php');
EDIT: nevermind, I figured it out! Thank you once again!
« Last Edit: November 30, 2010, 01:59:23 PM by Jesterhead »

Offline CygnusX

  • Level 24
  • *
  • Posts: 303
  • Reputation: +3/-2
    • View Profile
    • Lords of Midnight
Re: [SOLVED] Basics to Tick
« Reply #3 on: November 30, 2010, 02:07:18 PM »
I'd highly suggest sticking the cronjob_update.php file in a level above your www or public_html directory.  This way, bots and malicious users won't stumble upon a way to mass update your game.

Offline Jesterhead

  • Level 8
  • *
  • Posts: 41
  • Reputation: +1/-0
  • In Flames we trust!
    • View Profile
Re: [SOLVED] Basics to Tick
« Reply #4 on: November 30, 2010, 02:34:49 PM »
I see, I still need to figure out a lot of protections. Such as MYSQL-injection etc...

Thanks for the tip :)

EDIT:

Well I thought this worked, I went to my control panel and filled in everything like they wanted. For the command section it said:
Code: [Select]
Example: /usr/bin/lynx -dump /home/www/companyurl.com/cron.php
so i changed it to my url:
Code: [Select]
/usr/bin/lynx -dump /home/www/myurl.com/cronjobs/cronjobs.php
Because I had to fill a e-mail adress in the form, I received a e-mail notification showing the code of my cronjobs.php file. (nothing else)
Altough, the file did not run!

I've been changing stuff around for hours now, checked the permission (it's on 755), checked my code over and over again (my script works if you just enter the url in the browser!)

Any idea's? I'm getting so frustrated

EDIT 2:

Fixed it, had to contact the technical support. I fail.
« Last Edit: November 30, 2010, 05:02:39 PM by Jesterhead »

 


SimplePortal 2.3.3 © 2008-2010, SimplePortal