![]() |
#1
|
||||
|
||||
![]()
I thought this might be helpful for people who want some automatic functions on their site. Special thanks to Kyttias and IntoRain!
Disclaimer: It is not recommended that you have several cronjobs running at once unless you have a really good server, because it can potentially slow things down; especially if the runtime is frequent (IE: running several times a day) -Introduction- Create a new file in public_html (or wherever you have mysidia installed) called cron.php. Inside, paste this: PHP Code:
More often then not, you're going to want to do some math. Whether it's giving pets realtime needs or some sort of daily rewards system, the database needs to know how to math. Go to class_database.php and add this: Pastebin Link Here are the examples IntoRain gave on how these can now be used in scripts: PHP Code:
From here, it's just like coding for any other part of the script. Go to cron.php and create a new function like this (do not add anything to the index function or construct function!): PHP Code:
PHP Code:
Adding little notes right inside the functions is something I recommend so you can easily tell when it should run at a glance. They're also helpful if you have multiple coders, so notes are good! -Making it go- Now that you created your function, you need to run it. You might have noticed that cron.php has no coding on actually running the functions, and that's intentional! Many server hosts (including mysidia host) have CPanel available. Access it and navigate to cronjobs under the "advanced" section. ![]() (cpanel) ![]() (retro cpanel) ![]() (mysidiahost client area) Luckily for us, the page is full of presets. Clicking on the dropdowns allows you to specify exactly when you want the cronjob to run (even down to an exact minute once a year!) Customize it however you want. Afterwards use this for the command section: Code:
curl http://YOURSITE.com/cron/FUNCTION Code:
curl http://adopttest.mysidiahost.com/cron/changeSeason
__________________
|
Thread Tools | |
Display Modes | |
|
|
What's New? |
What's Hot? |
What's Popular? |