4WebHelp
 FAQ  •  Search  •  User Groups  •  Forum Admins  •  Smilies List  •  Statistics  •  Rules   •  Login   •  Register
Toggle Navigation Menu

 PHP Cron Jobs
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic
Author Message
Iyonix
WebHelper
WebHelper


Joined: 12 Nov 2002
Posts: 82
Location: Yarm, England

PostPosted: Wed Feb 12, 2003 7:01 pm (21 years, 2 months ago) Reply with QuoteBack to Top

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
OfflineView User's ProfileFind all posts by IyonixSend Personal Message
Daniel
Team Member



Joined: 06 Jan 2002
Posts: 2564

PostPosted: Wed Feb 12, 2003 8:27 pm (21 years, 2 months ago) Reply with QuoteBack to Top

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 Very Happy.

________________________________
Image
OfflineView User's ProfileFind all posts by DanielSend Personal Message
Iyonix
WebHelper
WebHelper


Joined: 12 Nov 2002
Posts: 82
Location: Yarm, England

PostPosted: Wed Feb 12, 2003 10:09 pm (21 years, 2 months ago) Reply with QuoteBack to Top

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
OfflineView User's ProfileFind all posts by IyonixSend Personal Message
Daniel
Team Member



Joined: 06 Jan 2002
Posts: 2564

PostPosted: Thu Feb 13, 2003 8:58 am (21 years, 2 months ago) Reply with QuoteBack to Top

This looks to be exactly what you need:

http://www.bitfolge.de/?l=en&s=pseudocron

Let us know how you get on with it.

Here's another one:

http://www.gemini1consulting.com/tekhelp/

________________________________
Image
OfflineView User's ProfileFind all posts by DanielSend Personal Message
Iyonix
WebHelper
WebHelper


Joined: 12 Nov 2002
Posts: 82
Location: Yarm, England

PostPosted: Thu Feb 13, 2003 11:01 pm (21 years, 2 months ago) Reply with QuoteBack to Top

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
OfflineView User's ProfileFind all posts by IyonixSend Personal Message
Display posts from previous:      
Post New TopicReply to Topic
View Previous Topic Print this topic View Next Topic


 Jump to:   




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.13727 seconds :: 18 queries executed :: All Times are GMT
Powered by phpBB 2.0 © 2001, 2002 phpBB Group :: Based on an FI Theme