Hallo leden van CP,
Ik heb een probleem.
Ik ben bezig met eigen maffia game te maken,
Ik ben al bijna klaar alleen heb ik problemen want de crons werken niet!
Ik heb alles nagekeken maar kon het niet vinden daarom vraag ik het hier.
SQL:
PHP
--
-- Tabel structuur voor tabel `[cron]`
--
CREATE TABLE IF NOT EXISTS `[cron]` (
`time` datetime default NULL,
`name` varchar(16) NOT NULL default '',
PRIMARY KEY (`name`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Gegevens worden uitgevoerd voor tabel `[cron]`
--
INSERT INTO `[cron]` (`time`, `name`) VALUES
('2009-10-21 22:01:10', 'horserace'),
('2009-10-21 22:00:45', 'month'),
('2009-10-21 22:00:24', 'week'),
('2009-10-21 21:59:41', 'day'),
('2009-10-21 21:59:31', 'hour'),
('2009-10-21 22:01:17', 'beurs');
Toon Meer
Het stukje in include:
PHP
<?
exit;
}
if(isset($UPDATE_DB)) {
$dbres = mysql_query("SELECT UNIX_TIMESTAMP(`time`) AS `time`,`name` FROM `[cron]`");
while($x = mysql_fetch_object($dbres))
$update[$x->name] = $x->time;
if(floor($update['beurs']/600) != floor(time()/600)) {
$dbres = mysql_query("SELECT GET_LOCK('beurs_update',0)");
if(mysql_result($dbres,0) == 1) {
$cron_pass = "secretcronpassword";
mysql_query("UPDATE `[cron]` SET `time`=NOW() WHERE `name`='beurs'");
include("beurs.php");
mysql_query("SELECT RELEASE_LOCK('beurs_update')");
}
}
if(floor($update['hour']/3600) != floor(time()/3600)) {
$dbres = mysql_query("SELECT GET_LOCK('hour_update',0)");
if(mysql_result($dbres,0) == 1) {
$cron_pass = "secretcronpassword";
mysql_query("UPDATE `[cron]` SET `time`=NOW() WHERE `name`='hour'");
include("hour.php");
mysql_query("SELECT RELEASE_LOCK('hour_update')");
}
}
if(floor($update['day']/86400) != floor(time()/86400)) {
$dbres = mysql_query("SELECT GET_LOCK('day_update',0)");
if(mysql_result($dbres,0) == 1) {
$cron_pass = "secretcronpassword";
mysql_query("UPDATE `[cron]` SET `time`=NOW() WHERE `name`='day'");
include("day.php");
mysql_query("SELECT RELEASE_LOCK('day_update')");
}
}
if(floor($update['week']/604800) != floor(time()/604800)) {
$dbres = mysql_query("SELECT GET_LOCK('week_update',0)");
if(mysql_result($dbres,0) == 1) {
$cron_pass = "secretcronpassword";
mysql_query("UPDATE `[cron]` SET `time`=NOW() WHERE `name`='week'");
include("week.php");
mysql_query("SELECT RELEASE_LOCK('week_update')");
}
}
if(date('n',$update['month']) != date('n',time())) {
$dbres = mysql_query("SELECT GET_LOCK('month_update',0)");
if(mysql_result($dbres,0) == 1) {
$cron_pass = "secretcronpassword";
mysql_query("UPDATE `[cron]` SET `time`=NOW() WHERE `name`='month'");
include("month.php");
mysql_query("SELECT RELEASE_LOCK('month_update')");
}
}
}
ENDHTML;
/* ------------------------- */ ?>
Toon Meer
Alvast bedankt allemaal