Shakeynath Posted May 13, 2010 Share Posted May 13, 2010 My cron day has just suddenly stopped working, Its running on a cron job but even when i manually do it it doesn't work. Its not truncating my vote table everyday or lowering the days down in school. My cron_day.php <?php include "config.php"; global $_CONFIG; if($_GET['code'] != $_CONFIG['code']) { die(""); } 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; $db->query("UPDATE fedjail set fed_days=fed_days-1"); $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"); $db->query("UPDATE users SET daysold=daysold+1, boxes_opened=0"); $db->query("UPDATE users SET turns = 25 WHERE turns != 25"); $db->query("UPDATE users SET mailban=mailban-1 WHERE mailban > 0"); $db->query("UPDATE users SET donatordays=donatordays-1 WHERE donatordays > 0"); $db->query("UPDATE users SET cdays=cdays-1 WHERE course > 0"); $db->query("UPDATE users SET bankmoney=bankmoney+(bankmoney/50) where bankmoney>0"); $db->query("UPDATE users SET cybermoney=cybermoney+(cybermoney/100*7) where cybermoney>0"); $sql = sprintf("SELECT * FROM creditcard"); $sql = mysql_query($sql); while($get = mysql_fetch_array($sql)) { $limit = 1000000000000000; ///Set the top limit for the money aloud in credit cards, so they dont go in minus 0_o if($get['creditcard'] > 0) { $update = sprintf("UPDATE creditcard SET creditcard = creditcard + (creditcard/100*5) WHERE creditcard > 0 AND creditcard < $limit AND SAonoff = 'on'"); $update = mysql_query($update); } } $q=$db->query("SELECT * FROM users WHERE cdays=0 AND course > 0"); while($r=$db->fetch_row($q)) { $cd=$db->query("SELECT * FROM courses WHERE crID={$r['course']}"); $coud=$db->fetch_row($cd); $userid=$r['userid']; $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!')"); } $db->query("UPDATE users SET course=0 WHERE cdays=0"); $db->query("TRUNCATE TABLE votes;"); $db->query("UPDATE users SET chatban=chatban-1 WHERE chatban > 0"); $db->query("UPDATE 'users' SET rates=1"); $db->query("UPDATE users SET safetries = 10 WHERE safetries < 10"); ?> Quote Link to comment Share on other sites More sharing options...
Danny696 Posted May 13, 2010 Share Posted May 13, 2010 $db->query("UPDATE 'users' SET rates=1"); << dont do the ' do ` Quote Link to comment Share on other sites More sharing options...
Shakeynath Posted May 13, 2010 Author Share Posted May 13, 2010 $db->query("UPDATE 'users' SET rates=1"); << dont do the ' do ` What you mean bud ? Quote Link to comment Share on other sites More sharing options...
Dave Posted May 13, 2010 Share Posted May 13, 2010 $db->query("UPDATE 'users' SET rates=1"); << dont do the ' do ` What you mean bud ? He means to replace the line which says $db->query("UPDATE 'users' SET rates=1"); to.. $db->query("UPDATE `users` SET rates=1"); Notice the difference between using ' and `. Quote Link to comment Share on other sites More sharing options...
Shakeynath Posted May 13, 2010 Author Share Posted May 13, 2010 Okay i have changed it mate but the cron still wont work, When i do it manually it comes up a blank white screen but it doesnt lower anything in the game. Im still in my local school for one day and ive loaded the cron_day.php file over 10 times "/ Quote Link to comment Share on other sites More sharing options...
Konsigliare Posted May 13, 2010 Share Posted May 13, 2010 [mysql]$db->query("TRUNCATE TABLE votes;");[/mysql] Doesn't need the ';' inside the query Try [mysql]$db->query("TRUNCATE TABLE votes");[/mysql] Quote Link to comment Share on other sites More sharing options...
Curt Posted May 13, 2010 Share Posted May 13, 2010 try adding error reporting to it and see if it gives you an error. add this right under <?php : error_reporting(E_ALL); cheers Quote Link to comment Share on other sites More sharing options...
Joshua Posted May 14, 2010 Share Posted May 14, 2010 just add OR die(mysql_error()); to the end of your queries, start at the top and work your way down till you find the issue, :P Quote Link to comment Share on other sites More sharing options...
Danny696 Posted May 15, 2010 Share Posted May 15, 2010 just add OR die(mysql_error()); to the end of your queries, start at the top and work your way down till you find the issue, :P $db already does that :P Quote Link to comment Share on other sites More sharing options...
kcmajor36 Posted May 22, 2010 Share Posted May 22, 2010 When you installed the game then installed the cron into cron jobs in your cPanel did you put Curl before? Quote Link to comment Share on other sites More sharing options...
Jordan Palmer Posted May 22, 2010 Share Posted May 22, 2010 I'm pretty sure I fixed this for him on MSN Quote Link to comment Share on other sites More sharing options...
Shakeynath Posted May 23, 2010 Author Share Posted May 23, 2010 I'm pretty sure I fixed this for him on MSN Yes ou did mate, I haven't had chance too make a reply lmaoo :) Cheers mate Quote Link to comment Share on other sites More sharing options...
KyleMassacre Posted January 24, 2012 Share Posted January 24, 2012 Im having the same issue. It worked before but now all of a sudden it stopped and my users can keep voting all they want and receive the rewards all they want Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.