jon182 Posted June 13, 2009 Posted June 13, 2009 ok this really has me stumped and i need help!!! <?php include "config.php"; global $_CONFIG, $jobstr, $jobiq, $joblab, $ir; 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 votes"); $db->query("DELETE FROM fedjail WHERE fed_days=0"); $db->query("UPDATE userstats SET IQ=IQ+$jobiq"); $db->query("UPDATE userstats SET labour=labour+$joblab"); $db->query("UPDATE userstats SET strength=strength+$jobstr"); $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 mailban=mailban-1 WHERE mailban > 0"); $db->query("UPDATE users SET millionare=millionare-1"); $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/500) where bankmoney>0"); $db->query("UPDATE users SET cybermoney=cybermoney+(cybermoney/100*7) where cybermoney>0"); $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;"); ?> Ok so i'v checked everything that has to do with the courses and it appears to be letter for letter identical to the original so idk why it's like this but when courses are "over" they don't actually end the days just go negative. anyone see whats wrong? Quote
TheMafia! Posted June 13, 2009 Posted June 13, 2009 Re: courses broke it might be your crons may be somthing like this $db->query("UPDATE users SET cdays=cdays-1 WHERE Course> 0 AND cdays > 0"); Quote
jon182 Posted June 13, 2009 Author Posted June 13, 2009 Re: courses broke ya i thought so but the original wasn't like that, i just set it to that i'll see if it works Quote
Olz Posted June 14, 2009 Posted June 14, 2009 Re: courses broke I have the same problem at the moment :oops: You are currently doing the Basic Survival Cooking Course, you have -9 days remaining. Quote
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.