hirev Posted June 3, 2008 Share Posted June 3, 2008 hi everyone my day cron seems to be working except for the bank part. any ideas its version 2 of mccodes. <?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 donatormoney=donatormoney+(donatormoney/100*8) where donatormoney>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 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"); $db->query("UPDATE users SET turns=25"); $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;"); if($r['money'] < 50 && $r['nsubscribed'] == 1) { $userid=$r['userid']; $db->query("INSERT INTO events VALUES('',$userid,unix_timestamp(),0,You did not have enouth money to pay for the newspaper this morning. Go to the <a href=nagent.php>news agents</a> to buy one.')"); $db->query("UPDATE users SET new_events=new_events+1 WHERE userid=$userid"); $db->query("UPDATE users SET newspaper=0 WHERE userid=$userid } else { $db->query("UPDATE users SET newspaper=0 WHERE nsubscribed=0"); $db->query("UPDATE users SET money=money-50 WHERE nsubscribed=1"); } ?> Quote Link to comment Share on other sites More sharing options...
Floydian Posted June 4, 2008 Share Posted June 4, 2008 Re: cron job for bank not working pls help me out I'm assuming this is the relevant portion here: $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"); Is it doing nothing? Have you tried running either of these queries in php my admin? syntactically speaking, there doesn't appear to be anything wrong with them. Quote Link to comment Share on other sites More sharing options...
hirev Posted June 6, 2008 Author Share Posted June 6, 2008 Re: cron job for bank not working pls help me out all i did was add the new bank and add the cron job and the SQL query.i am not sure what do do next. sorry if i am sounding stupid at this this is kind of new to me... its a pain in the ass right now as i cant launch my game till i get this fixed Quote Link to comment Share on other sites More sharing options...
Floydian Posted June 7, 2008 Share Posted June 7, 2008 Re: cron job for bank not working pls help me out Have you tried running either of these queries in php my admin? Quote Link to comment Share on other sites More sharing options...
hirev Posted June 8, 2008 Author Share Posted June 8, 2008 Re: cron job for bank not working pls help me out i do not have a myadmin php or do you mean the mysql Quote Link to comment Share on other sites More sharing options...
Floydian Posted June 9, 2008 Share Posted June 9, 2008 Re: cron job for bank not working pls help me out Do you have Cpanel on your web host? I personally haven't seen one that doesn't have PHP MyAdmin on it. Regardless, when something isn't working right with code pertaining to a database query, it's standard to test the query out in a query browser. PHP MyAdmin is usually the way to do this. 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.