Jump to content

Cron trouble?


Recommended Posts

i am having a slight problem with my voting and schools...

They are not resetting.



include "config.php";

global $_CONFIG;

if($_GET['code'] != $_CONFIG['code'])

define("MONO_ON", 1);

require "class/class_db_{$_CONFIG['driver']}.php";

$db=new database;







$db->query("UPDATE fedjail set fed_days=fed_days-1");

$q=$db->query("SELECT * FROM fedjail WHERE fed_days=0");






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 log=log-1 WHERE log > 0");
$db->query("UPDATE users SET gymp=gymp-1 WHERE gymp > 0");

$db->query("UPDATE users SET daysingang=daysingang+1 WHERE gang > 0");

$db->query("UPDATE users SET daysold=daysold+1");

$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 daysmarried=daysmarried+1 WHERE married > 0");

$db->query("UPDATE users SET cdays=cdays-1 WHERE course > 0");

$db->query("UPDATE users SET course=0 WHERE cdays=0");
$db->query("TRUNCATE TABLE votes");

$db->query("TRUNCATE TABLE rating");
$db->query("UPDATE users SET boxes_opened=0");
$db->query("UPDATE passreset SET time=time-1 WHERE time > 0") or die(mysql_error());
$db->query("DELETE FROM passreset WHERE time<=0") or die(mysql_error());

$db->query("UPDATE users SET bankmoney=bankmoney*bankpercent+bankmoney WHERE bankmoney>0 AND 

$db->query("UPDATE users SET banklevel=1 WHERE bankmoney>0");
$db->query("UPDATE users SET cybermoney=cybermoney+(cybermoney/100*7) WHERE cybermoney>0 


$db->query("UPDATE users set ttime=ttime-1 WHERE ttime>0");
$q=$db->query("SELECT * FROM users WHERE cdays=0 AND course > 0");

$cd=$db->query("SELECT * FROM courses WHERE crID={$r['course']}");

$db->query("INSERT INTO coursesdone VALUES({$r['userid']},{$r

if($coud['crSTR'] > 0)

$ev.=", {$coud['crSTR']} strength";
if($coud['crGUARD'] > 0)
$ev.=", {$coud['crGUARD']} guard";

['crLABOUR'] > 0)
$ev.=", {$coud

['crLABOUR']} labour";
if($coud['crAGIL'] > 0)

$ev.=", {$coud['crAGIL']} agility";
if($coud['crIQ'] > 0)

$ev.=", {$coud['crIQ']} IQ";
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!')")");



Any help?

Link to comment
Share on other sites

Re: Cron trouble?

You've got a syntax error at the very end there



Replace this:

$db->query("INSERT INTO events VALUES("$userid,unix_timestamp(),0,'Congratulations, you 

completed the {$coud['crNAME']} and gained $ev!')")");



With this:

$db->query("INSERT INTO events VALUES($userid,unix_timestamp(),0,'Congratulations, you 

completed the {$coud['crNAME']} and gained $ev!')");



And see if that doesn't fix it.

Link to comment
Share on other sites

Re: Cron trouble?

Check your cron logs?

Register an error handler so you can log any errors that might be missed by the cpanel error deal (that deal gets you fatal errors, but not necessarily minor errors)

Send cron output to an email you can check (do this from cpanel) OR alternatively, you can put in some debug type echoes through your cron file, snatch them all up using an output buffer, and mail them to an email (this is done completely from within your cron)

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Create New...