Jump to content
MakeWebGames

Some crons not working


gurpreet
 Share

Recommended Posts

In my day cron I seem to not have my job pay or job stat gains...Or the education gains.

 

<?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("UPDATE users SET csmuggling=csmuggling+10 WHERE csmuggling > 0");
$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 daysmarried=daysmarried+1 WHERE married !=0");
$db->query("UPDATE users SET userCONTRACT = userCONTRACT - 1 WHERE userCONTRACT > 0");
$db->query("UPDATE users SET userBANKAMMT = userBANKAMMT + (userBANKAMMT/100*5.5) WHERE userBANKAMMT > 0 AND investlevel = 1");
$db->query("UPDATE users SET userBANKAMMT = userBANKAMMT + (userBANKAMMT/100*3.0) WHERE userBANKAMMT > 0 AND investlevel = 0");
$db->query("UPDATE users SET userBANKAMMT = userBANKAMMT + (userBANKAMMT/100*7.2) WHERE userBANKAMMT > 0 AND investlevel = 2");
$db->query("UPDATE users SET userDAYS = userDAYS - 1 WHERE userDAYS != 0");
$db->query("UPDATE users SET mailban=mailban-1 WHERE mailban > 0");
$db->query("UPDATE users SET turns=100");
$db->query("UPDATE users SET donatordays=donatordays-1 WHERE donatordays > 0");
$db->query("UPDATE users SET donatordays=donatordays-1 WHERE donatordays > 0");
$db->query("UPDATE users SET rates=1");
$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 cdays=cdays-1 WHERE course > 0");
$db->query("UPDATE users SET bankmoney=bankmoney+(bankmoney/50) where bankmoney>0 && bankmoney < 15000000000");
$db->query("UPDATE users SET cybermoney=cybermoney+(cybermoney/100*7) where cybermoney>0 && cybermoney < 750000000000");
$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;");
?>

 

Any ideas what the queries are?

Link to comment
Share on other sites

Re: Some crons not working

 

<?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("UPDATE users SET csmuggling=csmuggling+10 WHERE csmuggling > 0");
$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 daysmarried=daysmarried+1 WHERE married !=0");
$db->query("UPDATE users SET userCONTRACT = userCONTRACT - 1 WHERE userCONTRACT > 0");
$db->query("UPDATE users SET userBANKAMMT = userBANKAMMT + (userBANKAMMT/100*5.5) WHERE userBANKAMMT > 0 AND investlevel = 1");
$db->query("UPDATE users SET userBANKAMMT = userBANKAMMT + (userBANKAMMT/100*3.0) WHERE userBANKAMMT > 0 AND investlevel = 0");
$db->query("UPDATE users SET userBANKAMMT = userBANKAMMT + (userBANKAMMT/100*7.2) WHERE userBANKAMMT > 0 AND investlevel = 2");
$db->query("UPDATE users SET userDAYS = userDAYS - 1 WHERE userDAYS != 0");
$db->query("UPDATE users SET mailban=mailban-1 WHERE mailban > 0");
$db->query("UPDATE users SET turns=100");
$db->query("UPDATE users SET donatordays=donatordays-1 WHERE donatordays > 0");
$db->query("UPDATE users SET rates=1");
$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 cdays=cdays-1 WHERE course > 0");
$db->query("UPDATE users SET bankmoney=bankmoney+(bankmoney/50) where bankmoney>0 && bankmoney < 15000000000");
$db->query("UPDATE users SET cybermoney=cybermoney+(cybermoney/100*7) where cybermoney>0 && cybermoney < 750000000000");
$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;");
?>

also try runing in your browser

http://www.yourgame.com/cron_day.php?code=your config code

It seems to be ok just maybe one spelling mistake on your tables???

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.

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

 Share

×
×
  • Create New...