First off I am new to this forum, so I hope I do this correctly. Anyway, I currently administrate a web based game. Every night at midnight, it would reset there daily awards that they can perform. Due to player request, we have made it to where they can choose the time that their daily awards would reset. We used the date(“G”) and created a script that will change a database to 0-23 based on there time choosing. So far, we have experienced mixed results with this. The CRON is running at the top of every hour, and it is working for most hours, but there are 4-5 hours on where it is not running. When looking at the emails for the account, the emails are reporting that its running the PHP code with no problem. Any suggestions?


<?php include "config.php"; include "language.php"; global $_CONFIG; define("MONO_ON", 1); require "class/class_db_{$_CONFIG['driver']}.php"; $db=new database; $db->configure($_CONFIG['hostname'], $_CONFIG['username'], $_CONFIG['password'], $_CONFIG['database'], $_CONFIG['persistent']); $db->connect(); $c=$db->connection_id; $today = date('G'); // $today = 0; $q5=$db->query("SELECT * FROM users WHERE userid > 0 AND rollovertime=$today"); while($r3=$db->fetch_row($q5)) { $who = $r3['userid']; $db->query("UPDATE fedjail set fed_days=fed_days-1 WHERE fed_userid=$who"); $q=$db->query("SELECT * FROM fedjail WHERE fed_days=0"); $ids=array(); while($r=$db->fetch_row($q)) { $ids[]=$r['fed_userid']; } if(count($ids) > 0) { $db->query("UPDATE users SET fedjail=0 WHERE userid IN(".implode(",", $ids).")"); } $db->query("DELETE FROM fedjail WHERE fed_days=0"); $db->query("UPDATE users SET daysingang=daysingang+1 WHERE gang > 0 AND userid=$who"); $db->query("UPDATE users SET daysold=daysold+1, boxes_opened=0 WHERE userid=$who"); $db->query("UPDATE users SET mailban=mailban-1 WHERE mailban > 0 AND userid=$who"); $db->query("UPDATE users SET cracksafe=0 WHERE userid=$who"); $db->query("UPDATE users SET donatordays=donatordays-1 WHERE donatordays > 0 AND userid=$who"); $db->query("UPDATE users SET cdays=cdays-1 WHERE course > 0 AND userid=$who"); $db->query("UPDATE users SET bankmoney=bankmoney+(bankmoney/50) WHERE bankmoney>0 AND userid=$who"); $db->query("UPDATE users SET cybermoney=cybermoney+(cybermoney/100*7) WHERE cybermoney>0 AND userid=$who"); $db->query("UPDATE users SET turns=10 WHERE userid=$who"); $db->query("UPDATE users SET dailyreward=0 WHERE userid=$who"); $db->query("UPDATE users SET rob=0 WHERE userid=$who"); $db->query("UPDATE users SET rates=15 WHERE userid=$who"); $db->query("UPDATE users SET warehouse=0 WHERE userid=$who"); $db->query("UPDATE users SET brothel=0 WHERE userid=$who"); $db->query("UPDATE users SET dondailyreward=0 WHERE userid=$who"); $db->query("UPDATE users SET sitevotes=0 WHERE userid=$who"); $db->query("UPDATE users SET crylottery=0 WHERE userid=$who"); $db->query("UPDATE users SET missle=0 WHERE userid=$who"); $db->query("UPDATE users SET wizardhands=0 WHERE userid=$who"); $db->query("UPDATE users SET sydney=2 WHERE userid=$who"); $db->query("UPDATE users SET beauty=3 WHERE userid=$who"); $db->query("UPDATE users SET witchroll=0 WHERE userid=$who"); $db->query("UPDATE users SET cashlot=0 WHERE userid=$who"); $db->query("UPDATE users SET graverob=0 WHERE userid=$who"); $db->query("UPDATE users SET wpdays=wpdays-1 WHERE wpdays > 0 AND userid=$who"); $db->query("UPDATE users SET kiddays=kiddays-1 WHERE kiddays > 0 AND userid=$who"); $db->query("UPDATE users SET npcday=npcday+1 WHERE userid=$who AND userid=$who"); $db->query("UPDATE `userfarm` SET `ffertilized`=0 WHERE `ffertilized` !=0 AND fuserid=$who"); $db->query("UPDATE `userfarm` SET `age`=`age`+1 WHERE `age` < 8 AND fuserid=$who"); $db->query("DELETE FROM `userfarm` WHERE `age`>7 AND fuserid=$who"); $db->query("DELETE FROM `votes` WHERE userid=$who"); $q3=$db->query("SELECT * FROM users WHERE npcday >= 20 AND userid=$who"); while($r3=$db->fetch_row($q3)) { $db->query("UPDATE users SET location=1 WHERE userid=$who"); } $q=$db->query("SELECT * FROM users WHERE cdays=0 AND course > 0 AND userid=$who"); while($r=$db->fetch_row($q)) { $cd=$db->query("SELECT * FROM courses WHERE crID={$r['course']}"); $coud=$db->fetch_row($cd); $userid=$who; $db->query("INSERT INTO coursesdone VALUES({$r['userid']},{$r['course']})"); $upd=""; $ev=""; if($coud['crSTR'] > 0) { $upd.=",us.strength=us.strength+{$coud['crSTR']}"; $ev.=", {$coud['crSTR']} strength"; } if($coud['crGUARD'] > 0) { $upd.=",us.guard=us.guard+{$coud['crGUARD']}"; $ev.=", {$coud['crGUARD']} guard"; } if($coud['crLABOUR'] > 0) { $upd.=",us.labour=us.labour+{$coud['crLABOUR']}"; $ev.=", {$coud['crLABOUR']} labour"; } if($coud['crAGIL'] > 0) { $upd.=",us.agility=us.agility+{$coud['crAGIL']}"; $ev.=", {$coud['crAGIL']} agility"; } if($coud['crIQ'] > 0) { $upd.=",us.IQ=us.IQ+{$coud['crIQ']}"; $ev.=", {$coud['crIQ']} IQ"; } $ev=substr($ev,1); if ($upd) { $db->query("UPDATE users u LEFT JOIN userstats us ON u.userid=us.userid SET us.userid=us.userid $upd WHERE u.userid=$userid"); $db->query("INSERT INTO events VALUES('',$userid,unix_timestamp(),0,'Congratulations, you completed the {$coud['crNAME']} and gained $ev!')"); } } $q4=$db->query("SELECT * FROM users WHERE pimps > 0 AND userid=$who"); while($r2=$db->fetch_row($q4)) { $reward = $r2['pimps']*100000; $personid = $who; $db->query("UPDATE users SET money=money+$reward WHERE userid=$personid"); } $q5=$db->query("SELECT * FROM users WHERE userid = $who"); while($r3=$db->fetch_row($q5)) { $reward = $r3['level']*1000; $personid = $who; $db->query("UPDATE users SET money=money+$reward, new_events=new_events+1 WHERE userid=$personid"); $db->query("UPDATE users SET new_events=new_events+1 WHERE userid=$personid"); $db->query("INSERT INTO events VALUES('',$personid,unix_timestamp(),0,'Congratulations, you earned $reward for your rollover today. Dont spend it all in one place!')"); } } ?>


I do not know English,

Is serves the following job?

Sponsor our Newsletter | Privacy Policy | Terms of Service