|
Author |
Message |
Iyonix
WebHelper
Joined: 12 Nov 2002
Posts: 82
Location: Yarm, England
|
Posted:
Wed Feb 12, 2003 7:01 pm (21 years, 2 months ago) |
|
Hi,
My web host does not allow Cron tasks to be run, so I was wondering if there is a script that can be put into the common.php include file that will check when a file was last run and run it the appropriate number of times to catch up?
Thanks, |
________________________________ Iyonix |
|
|
|
Daniel
Team Member
Joined: 06 Jan 2002
Posts: 2564
|
Posted:
Wed Feb 12, 2003 8:27 pm (21 years, 2 months ago) |
|
Well I don't know of any particular script, but I do know of an equivalent replacement: webcron.org. Unfortunately it's in French, but it does all cron does. You enter a URL and specify when it has to be run, and that's it.
Beware, though, of scripts which produce output: webcron will store it, and after a while you exceed your storage limit. Your account is then disactivated until you empty the output storage. However it works fine if your script produces no output . |
________________________________
|
|
|
|
Iyonix
WebHelper
Joined: 12 Nov 2002
Posts: 82
Location: Yarm, England
|
Posted:
Wed Feb 12, 2003 10:09 pm (21 years, 2 months ago) |
|
I tried webcron.org, but unfortunately I need to run the script every 2 mins. They only allow every 1hr which is too long for givving users turns in an online game.
Anyone else got any ideas??? |
________________________________ Iyonix |
|
|
|
Daniel
Team Member
Joined: 06 Jan 2002
Posts: 2564
|
Posted:
Thu Feb 13, 2003 8:58 am (21 years, 2 months ago) |
|
|
|
|
Iyonix
WebHelper
Joined: 12 Nov 2002
Posts: 82
Location: Yarm, England
|
Posted:
Thu Feb 13, 2003 11:01 pm (21 years, 2 months ago) |
|
I tried them, but I just couldn't get them to work, so I wrote my own script to do what I want the right number of times at the right interval:
Code: |
$timestamp=time();
$link_id = @mysql_connect("localhost","warrior","***********");
mysql_select_db("warrior", $link_id);
$time=mysql_query("SELECT time FROM warrior_turns");
$time=mysql_fetch_array($time);
$time=$time[0];
//echo $time."<br>";
$diff=$timestamp-$time;
//echo $diff."<br>";
$diff=$diff/120;
//echo $diff."<br>";
list($turnsneeded, $remainder) = explode(".",$diff);
//echo $turnsneeded." turns are needed<br>";
//echo $remainder." of 120 secs is left<br>";
$timeleft=($diff-$turnsneeded)*120;
//echo $timeleft." is time left<br>";
$timeleft=$timestamp-$timeleft;
mysql_query("UPDATE warrior_userdata SET turns = turns +".$turnsneeded." WHERE turns < 2000");
mysql_query("UPDATE warrior_turns SET time = $timeleft");
//echo mysql_error();
mysql_close($link_id);
|
|
________________________________ Iyonix |
|
|
|
|
|
You cannot post new topics in this forum. You cannot reply to topics in this forum. You cannot edit your posts in this forum. You cannot delete your posts in this forum. You cannot vote in polls in this forum.
|
Page generation time: 0.120862 seconds :: 19 queries executed :: All Times are GMT
Powered by phpBB 2.0
© 2001, 2002 phpBB Group :: Based on an FI Theme
| |