Jump to content
MakeWebGames

cron day


boionfire81

Recommended Posts

This line is keeping my cron day from running

 

require_once('globals_nonauth.php');
if ($argc == 2)
{
   if ($argc[1] != $_CONFIG['code'])
   {
       exit;
   }
}
else if (!isset($_GET['code']) || $_GET['code'] !== $_CONFIG['code'])
{
   exit;
}

 

reason argc undefined. It is right under globals.php

Link to comment
Share on other sites

This line is keeping my cron day from running

 

require_once('globals_nonauth.php');
if ($argc == 2)
{
if ($argc[1] != $_CONFIG['code'])
{
exit;
}
}
else if (!isset($_GET['code']) || $_GET['code'] !== $_CONFIG['code'])
{
exit;
}

 

reason argc undefined. It is right under globals.php

have you checked your cron job manager to make sure the code matches the code in the config.php file this will stop your cron from running.

 

You can probably just remove that and just check the config code. Replace that snippet with this:
if(!isset($_GET['code']) || $_GET['code'] !== $_CONFIG['code'])
exit;

I dont really understand what that is. I just checked my copy of globals and non_auth and cant find it

 

there is no reference to it anyplace that i can find lol

Link to comment
Share on other sites

I have my cron jobs set to alert me when there is an error. This is what I get

 

A non-critical error has occurred. Page execution will continue. Below are the details:<br /><strong>PHP Deprecation Notice</strong>: mysql_connect(): The mysql extension is deprecated and will be removed in the future: use mysqli or PDO instead (8192)<br /><br /><strong>Line executed</strong>: /home/public_html/class/class_db_mysql.php:82<br /><br />

 

My cron is

 

<?php
/**
* MCCodes Version 2.0.5b
* Copyright (C) 2005-2012 Dabomstew
* All rights reserved.
*
* Redistribution of this code in any form is prohibited, except in
* the specific cases set out in the MCCodes Customer License.
*
* This code license may be used to run one (1) game.
* A game is defined as the set of users and other game database data,
* so you are permitted to create alternative clients for your game.
*
* If you did not obtain this code from MCCodes.com, you are in all likelihood
* using it illegally. Please contact MCCodes to discuss licensing options
* in this case.
*
* File: cron_minute.php
*
*/

require_once('globals_nonauth.php');
//if ($argc == 2)
//{
//    if ($argv[1] != $_CONFIG['code'])
//    {
//        exit;
//    }
//}
//else if (!isset($_GET['code']) || $_GET['code'] !== $_CONFIG['code'])
//{
//    exit;
//}
if(!isset($_GET['code']) || $_GET['code'] !== $_CONFIG['code'])
{ exit; }
$db->query(
       "UPDATE `users` SET `hospital` = GREATEST(`hospital` - 1, 0), `jail` = GREATEST(`jail` - 1, 0)");
$counts =
       $db->fetch_row(
               $db->query(
                       "SELECT SUM(IF(`hospital` > 0, 1, 0)) AS `hc`, SUM(IF(`jail` > 0, 1, 0)) AS `jc` FROM `users`"));
$db->query(
       "UPDATE `settings` SET `conf_value` = '{$counts['hc']}' WHERE `conf_name` = 'hospital_count'");
$db->query(
       "UPDATE `settings` SET `conf_value` = '{$counts['jc']}' WHERE `conf_name` = 'jail_count'");
       $expired = $db->query("SELECT `userid`,`expire` FROM `users` WHERE `expire`=1");
while($ex=$db->fetch_row($expired))
{
$findout = $db->query("SELECT `strength`,`agility`,`guard` FROM `oldstats` WHERE `userid`=".$ex['userid']."");
$update = $db->fetch_row($findout);

$db->query("UPDATE `userstats` SET `agility`=".$update['agility'].",`strength`=".$update['strength'].",`guard`=".$update['guard']." WHERE `userid`=".$ex['userid']."");
}
$db->query("DELETE FROM `oldstats` WHERE `userid`=".$ex['userid']."");
$db->query("UPDATE `users` SET `expire`=0 WHERE `userid`=".$ex['userid']."");
$db->query("UPDATE `rehab` SET `rTIME`=`rTIME`-1 WHERE `rTIME`>0");

# check if there is anyone traveling
$tcheck = $db->query("SELECT `time`,`userid`,`location`,`ttype` FROM `traveling` WHERE `time` >= 0");
if($db->num_rows($tcheck))
{
   while($t = $db->fetch_row($tcheck))
   {
       if($t['time'])
       {
           $db->query("UPDATE `traveling` SET `time` = GREATEST(`time` - 1, 0)");
           if(mt_rand(1,3) == 3)
           {
               $insured = $db->query("SELECT `insured`,`money` FROM `users` WHERE `userid` = {$t['userid']}");
               $in = $db->fetch_row($insured);
               if($in['insured'])
               {
                   $travelcost = $db->fetch_single($db->query("SELECT `travelcost` FROM `locations`
                       WHERE `ttype` = {$t['ttype']} AND `cityid` = {$t['location']}"));
                   if($t['ttype'] == 'Car')
                   {
                       switch(mt_rand(1,4))
                       {
                           case 1:
                               $msg = $db->escape("Your tire poped and your car spun out of control");
                               $time = mt_rand(1,5);
                               $money = $travelcost / 100 * 50 / 2;
                               $in['money'] += $money;
                               $db->query("UPDATE `users` SET `hospital` = {$time},
                                   `hospreason` = '{$msg}',`money` = {$in['money']} WHERE `userid` = {$t['userid']}");
                               $db->query("INSERT INTO `mail` VALUES (NULL, 0, 0, {$t['userid']}, ".time().",
                               'Insurance Team', 'As you are insured we have returned half of your travel cost
                               which is ".money_formatter($money)."')");
                                   $db->query("UPDATE `users` SET `new_mail` = `new_mail` + 1 WHERE `userid` = {$t['userid']}");
                               event_add($t['userid'], "You had a acident while traveling.<br /> {$msg}.");
                               $db->query("DELETE FROM `traveling` WHERE `userid` = {$t['userid']}");
                           break;
                           case 2:
                               $msg = $db->escape("You fainted while driving");
                               $time = mt_rand(1,15);
                               $money = $travelcost / 100 * 50 / 2;
                               $in['money'] += $money;
                               $db->query("UPDATE `users` SET `hospital` = {$time},
                                   `hospreason` = '{$msg}',`money` = {$in['money']} WHERE `userid` = {$t['userid']}");
                               $db->query("INSERT INTO `mail` VALUES (NULL, 0, 0, {$t['userid']}, ".time().",
                               'Insurance Team', 'As you are insured we have returned half of your travel cost
                               which is ".money_formatter($money)."')");
                                   $db->query("UPDATE `users` SET `new_mail` = `new_mail` + 1 WHERE `userid` = {$t['userid']}");
                               event_add($t['userid'], "You had a acident while traveling.<br /> {$msg}.");
                               $db->query("DELETE FROM `traveling` WHERE `userid` = {$t['userid']}");
                           break;
                           case 3:
                               $msg = $db->escape("A crazy driver ran you off the road");
                               $time = mt_rand(1,25);
                               $money = $travelcost / 100 * 50 / 2;
                               $in['money'] += $money;
                               $db->query("UPDATE `users` SET `hospital` = {$time},
                                   `hospreason` = '{$msg}',`money` = {$in['money']} WHERE `userid` = {$t['userid']}");
                               $db->query("INSERT INTO `mail` VALUES (NULL, 0, 0, {$t['userid']}, ".time().",
                               'Insurance Team', 'As you are insured we have returned half of your travel cost
                               which is ".money_formatter($money)."')");
                                   $db->query("UPDATE `users` SET `new_mail` = `new_mail` + 1 WHERE `userid` = {$t['userid']}");
                               event_add($t['userid'], "You had a acident while traveling.<br /> {$msg}.");
                               $db->query("DELETE FROM `traveling` WHERE `userid` = {$t['userid']}");
                           break;
                           case 4;
                               $msg = $db->escape("Your car engine exploded");
                               $time = mt_rand(1,50);
                               $money = $travelcost / 100 * 50 / 2;
                               $in['money'] += $money;
                               $db->query("UPDATE `users` SET `hospital` = {$time},
                                   `hospreason` = '{$msg}',`money` = {$in['money']} WHERE `userid` = {$t['userid']}");
                               $db->query("INSERT INTO `mail` VALUES (NULL, 0, 0, {$t['userid']}, ".time().",
                               'Insurance Team', 'As you are insured we have returned half of your travel cost
                               which is ".money_formatter($money)."')");
                                   $db->query("UPDATE `users` SET `new_mail` = `new_mail` + 1 WHERE `userid` = {$t['userid']}");
                               event_add($t['userid'], "You had a acident while traveling.<br /> {$msg}.");
                               $db->query("DELETE FROM `traveling` WHERE `userid` = {$t['userid']}");
                           break;
                       }    
                   }
                   else if($t['ttype'] == 'Boat')
                   {
                       switch(mt_rand(1,3))
                       {
                           case 1:
                               $msg = $db->escape("Your boat hit a rock and you bumped your head");
                               $time = mt_rand(1,5);
                               $money = $travelcost / 100 * 50 / 2;
                               $in['money'] += $money;
                               $db->query("UPDATE `users` SET `hospital` = {$time},
                                   `hospreason` = '{$msg}',`money` = {$in['money']} WHERE `userid` = {$t['userid']}");
                               event_add($t['userid'], "You had a acident while traveling.<br /> {$msg}.");
                           break;
                           case 2:
                               $msg = $db->escape("The boats engine stopped working and you tried to fix it and lost your hand");
                               $time = mt_rand(1,15);
                               $money = $travelcost / 100 * 50 / 2;
                               $in['money'] += $money;
                               $db->query("UPDATE `users` SET `hospital` = {$time},
                                   `hospreason` = '{$msg}',`money` = {$in['money']} WHERE `userid` = {$t['userid']}");
                               event_add($t['userid'], "You had a acident while traveling.<br /> {$msg}.");
                           break;
                           case 3:
                               $msg = $db->escape("The boats engine exploded");
                               $time = mt_rand(1,25);
                               $money = $travelcost / 100 * 50 / 2;
                               $in['money'] += $money;
                               $db->query("UPDATE `users` SET `hospital` = {$time},
                                   `hospreason` = '{$msg}',`money` = {$in['money']} WHERE `userid` = {$t['userid']}");
                               event_add($t['userid'], "You had a acident while traveling.<br /> {$msg}.");
                           break;
                       }    
                   }
                   else if($t['ttype'] == 'Bus')
                   {
                       switch(mt_rand(1,3))
                       {
                           case 1:
                               $msg = $db->escape("The bus swearved another car and tumbled over you were hurt in acident");
                               $time = mt_rand(1,5);
                               $money = $travelcost / 100 * 50 / 2;
                               $in['money'] += $money;
                               $db->query("UPDATE `users` SET `hospital` = {$time},
                                   `hospreason` = '{$msg}',`money` = {$in['money']} WHERE `userid` = {$t['userid']}");
                               event_add($t['userid'], "You had a acident while traveling.<br /> {$msg}.");
                           break;
                           case 2:
                               $msg = $db->escape("Gang of thugs pull a driveby on your bus");
                               $time = mt_rand(1,15);
                               $money = $travelcost / 100 * 50 / 2;
                               $in['money'] += $money;
                               $db->query("UPDATE `users` SET `hospital` = {$time},
                                   `hospreason` = '{$msg}',`money` = {$in['money']} WHERE `userid` = {$t['userid']}");
                               event_add($t['userid'], "You had a acident while traveling.<br /> {$msg}.");
                           break;
                           case 3:
                               $msg = $db->escape("The buses engine exploded");
                               $time = mt_rand(1,25);
                               $money = $travelcost / 100 * 50 / 2;
                               $in['money'] += $money;
                               $db->query("UPDATE `users` SET `hospital` = {$time},
                                   `hospreason` = '{$msg}',`money` = {$in['money']} WHERE `userid` = {$t['userid']}");
                               event_add($t['userid'], "You had a acident while traveling.<br /> {$msg}.");
                           break;
                       }
                   }
                   else
                   {
                       switch(mt_rand(1,2))
                       {
                           case 1:
                               $msg = $db->escape("Pilot fell aleep at wheel lucky the co was there and stoped a big acidident");
                               $time = mt_rand(1,5);
                               $money = $travelcost / 100 * 50 / 2;
                               $in['money'] += $money;
                               $db->query("UPDATE `users` SET `hospital` = {$time},
                                   `hospreason` = '{$msg}',`money` = {$in['money']} WHERE `userid` = {$t['userid']}");
                               event_add($t['userid'], "You had a acident while traveling.<br /> {$msg}.");
                           break;
                           case 2:
                               $msg = $db->escape("Planes Engines failed and crashed you were the only survior");
                               $time = mt_rand(1,45);
                               $money = $travelcost / 100 * 50 / 2;
                               $in['money'] += $money;
                               $db->query("UPDATE `users` SET `hospital` = {$time},
                                   `hospreason` = '{$msg}',`money` = {$in['money']} WHERE `userid` = {$t['userid']}");
                               event_add($t['userid'], "You had a acident while traveling.<br /> {$msg}.");
                           break;
                       }
                   }
               }
               else
               {
                   if($t['ttype'] == 'Car')
                   {
                       switch(mt_rand(1,4))
                       {
                           case 1:
                               $msg = $db->escape("Your tire poped and your car spun out of control");
                               $time = mt_rand(1,5);
                               $db->query("UPDATE `users` SET `hospital` = {$time},
                                   `hospreason` = '{$msg}'WHERE `userid` = {$t['userid']}");
                               event_add($t['userid'], "You had a acident while traveling.<br /> {$msg}.");
                               $db->query("DELETE FROM `traveling` WHERE `userid` = {$t['userid']}");
                           break;
                           case 2:
                               $msg = $db->escape("You fainted while driving");
                               $time = mt_rand(1,15);                                
                               $db->query("UPDATE `users` SET `hospital` = {$time},
                                   `hospreason` = '{$msg}' WHERE `userid` = {$t['userid']}");
                               event_add($t['userid'], "You had a acident while traveling.<br /> {$msg}.");
                               $db->query("DELETE FROM `traveling` WHERE `userid` = {$t['userid']}");
                           break;
                           case 3:
                               $msg = $db->escape("A crazy driver ran you off the road");
                               $time = mt_rand(1,25);
                               $db->query("UPDATE `users` SET `hospital` = {$time},
                                   `hospreason` = '{$msg}' WHERE `userid` = {$t['userid']}");
                               event_add($t['userid'], "You had a acident while traveling.<br /> {$msg}.");
                               $db->query("DELETE FROM `traveling` WHERE `userid` = {$t['userid']}");
                           break;
                           case 4;
                               $msg = $db->escape("Your car engine exploded");
                               $time = mt_rand(1,50);                            
                               $db->query("UPDATE `users` SET `hospital` = {$time},
                                   `hospreason` = '{$msg}' WHERE `userid` = {$t['userid']}");                                
                               event_add($t['userid'], "You had a acident while traveling.<br /> {$msg}.");
                               $db->query("DELETE FROM `traveling` WHERE `userid` = {$t['userid']}");
                           break;
                       }    
                   }
                   else if($t['ttype'] == 'Boat')
                   {
                       switch(mt_rand(1,3))
                       {
                           case 1:
                               $msg = $db->escape("Your boat hit a rock and you bumped your head");
                               $time = mt_rand(1,5);
                               $db->query("UPDATE `users` SET `hospital` = {$time},
                                   `hospreason` = '{$msg}' WHERE `userid` = {$t['userid']}");
                               event_add($t['userid'], "You had a acident while traveling.<br /> {$msg}.");
                           break;
                           case 2:
                               $msg = $db->escape("The boats engine stopped working and you tried to fix it and lost your hand");
                               $time = mt_rand(1,15);
                               $db->query("UPDATE `users` SET `hospital` = {$time},
                                   `hospreason` = '{$msg}' WHERE `userid` = {$t['userid']}");
                               event_add($t['userid'], "You had a acident while traveling.<br /> {$msg}.");
                           break;
                           case 3:
                               $msg = $db->escape("The boats engine exploded");
                               $time = mt_rand(1,25);
                               $db->query("UPDATE `users` SET `hospital` = {$time},
                                   `hospreason` = '{$msg}' WHERE `userid` = {$t['userid']}");
                               event_add($t['userid'], "You had a acident while traveling.<br /> {$msg}.");
                           break;
                       }    
                   }
                   else if($t['ttype'] == 'Bus')
                   {
                       switch(mt_rand(1,3))
                       {
                           case 1:
                               $msg = $db->escape("The bus swearved another car and tumbled over you were hurt in acident");
                               $time = mt_rand(1,5);
                               $db->query("UPDATE `users` SET `hospital` = {$time},
                                   `hospreason` = '{$msg}' WHERE `userid` = {$t['userid']}");
                               event_add($t['userid'], "You had a acident while traveling.<br /> {$msg}.");
                           break;
                           case 2:
                               $msg = $db->escape("Gang of thugs pull a driveby on your bus");
                               $time = mt_rand(1,15);
                               $db->query("UPDATE `users` SET `hospital` = {$time},
                                   `hospreason` = '{$msg}' WHERE `userid` = {$t['userid']}");
                               event_add($t['userid'], "You had a acident while traveling.<br /> {$msg}.");
                           break;
                           case 3:
                               $msg = $db->escape("The buses engine exploded");
                               $time = mt_rand(1,25);
                               $db->query("UPDATE `users` SET `hospital` = {$time},
                                   `hospreason` = '{$msg}' WHERE `userid` = {$t['userid']}");
                               event_add($t['userid'], "You had a acident while traveling.<br /> {$msg}.");
                           break;
                       }
                   }
                   else
                   {
                       switch(mt_rand(1,2))
                       {
                           case 1:
                               $msg = $db->escape("Pilot fell aleep at wheel lucky the co was there and stoped a big acidident");
                               $time = mt_rand(1,5);
                               $db->query("UPDATE `users` SET `hospital` = {$time},
                                   `hospreason` = '{$msg}' WHERE `userid` = {$t['userid']}");
                               event_add($t['userid'], "You had a acident while traveling.<br /> {$msg}.");
                           break;
                           case 2:
                               $msg = $db->escape("Planes Engines failed and crashed you were the only survior");
                               $time = mt_rand(1,45);
                               $db->query("UPDATE `users` SET `hospital` = {$time},
                                   `hospreason` = '{$msg}' WHERE `userid` = {$t['userid']}");
                               event_add($t['userid'], "You had a acident while traveling.<br /> {$msg}.");
                           break;
                       }
                   }
               }
           }
       }
       else
       {
           $db->query("UPDATE `users` SET `location` = {$t['location']},`traveling` = 0 WHERE `userid` = {$t['userid']}");    
           $db->query("DELETE FROM `traveling` WHERE `userid` = {$t['userid']} AND `time` = 0");
       }
   }
}

Link to comment
Share on other sites

lol well with the args in nothing below the args were working despite the error actually only being a notice. That was because of the ifs. So the arg error wasnt actually the issue. Make sense? lol 1 file, 30 lines, hundreds of possible reasons lol.

But it's fixed I think.

Removed the args completely (might be a security risk though?) and everything is working. I just cant subscribe to get error reports for crons because of the mysqli notice I get an email every 60 seconds. >.<

Link to comment
Share on other sites

Well, you shouldn't even be using MySQL to begin with since its outdated and vulnerable to injections a lot more. If you open your config.php file you will see the $_CONFIG array:

  $_CONFIG = array(    
   'hostname' => 'localhost',    
   'username' => 'root',    
   'password' => 'root',    
   'database' => 'originalmcc',    
   'persistent' => 0,  
   'driver' => 'mysqli', // <- This is what you want to change to    
   'code' => 'mysupersecretcodeishere',
); 

Just change the driver from mysql to mysqli and you should be in business

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.

×
×
  • Create New...