Jump to content

Education cron


Recommended Posts

My education days keep going into negative days, i've tried to fix it but i'm not sure how to fix it


include "REMOVED";
global $_CONFIG;
if($_GET['code'] != $_CONFIG['code']) { die(""); }
define("MONO_ON", 1);
require "REMOVED";
$db=new database;
$db->query("UPDATE users SET cdays=cdays-1 WHERE course > 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['course']})");
if($coud['crSTR'] > 0)
$ev.=", {$coud['crSTR']} strength";
if($coud['crGUARD'] > 0)
$ev.=", {$coud['crGUARD']} guard";
if($coud['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!')");
$db->query("UPDATE users SET course=0 WHERE cdays=0");
Link to comment
Share on other sites

Re: Education cron

Theres a couple ways to do this with just the quick look over I did...

One is this....

in your page find


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


change it to this


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


or instead of changing to that you can add this below that line i said find..


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


Either way should fix that for you.

Good luck hope this helps.

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...