Ragnar Posted July 18, 2008 Share Posted July 18, 2008 This error only shows up for ONE player.... Fatal error: Maximum execution time of 60 seconds exceeded in /public_html/viridiangym.php on line 49 The code of that line is.... $gain+=round(rand(1,3)/rand(800,1000)*rand(800,1000)*(($ir['will']+20)/150)); where it decides how much stats you gain. Is there anything there that can be changed to stop the error, or could it be his stats... INSERT INTO `userstats` VALUES (264, 14242950, 11653749, 10626609, 12381860, 12908602, 'yes'); It works fine for me and all other players that have used this gym. My stats... INSERT INTO `userstats` VALUES (1, 60627, 19960, 19352, 260384, 243616, 'yes'); Quote Link to comment Share on other sites More sharing options...
Floydian Posted July 18, 2008 Share Posted July 18, 2008 Re: Gym error: Fatal error: Maximum execution time of 60 seconds exceeded How many crystals is he using at a time? Each crystal = 1 loop. 10000 crystals = 10000 loops and that's a big shortcoming of the deal. That'd be the most likely problem. Quote Link to comment Share on other sites More sharing options...
Ragnar Posted July 18, 2008 Author Share Posted July 18, 2008 Re: Gym error: Fatal error: Maximum execution time of 60 seconds exceeded This gym uses cash, and he's paying 15 million bucks per train. Even if it was crystals, it would only be eight crystals. And it doesn't take 30 seconds to pay out, otherwise the markets and stores would always be generating that error. Based on your thery, every single $10,000 or above transaction would cause the error, since money and crystals are the exact same thing, just used for different stuff. $_POST['amnt']=($ir['will']*5*$ir['energy']); $db->query("UPDATE `users` SET money = money - {$_POST['amnt']} WHERE `userid` = $userid"); It doesn't take much at all for the script to figure out the cost and make payment. You can do transactions in the quintillions and that wouldn't generate the error. (Luckly the game hasn't got even close to quads yet!!) :-D Quote Link to comment Share on other sites More sharing options...
Floydian Posted July 18, 2008 Share Posted July 18, 2008 Re: Gym error: Fatal error: Maximum execution time of 60 seconds exceeded Okay, so you're gym takes cash. If you open up the code, you will see that there is a loop in there. Now, I doubt that it's set on a one to one ratio. 15 million in cash = 15 million loops (that'd just be redic...) But that certainly sounds like what's happening. Please note that this "loop" has nothing to do with shops and whatnot. This loop is part of the code in the standard gym's people have. Quote Link to comment Share on other sites More sharing options...
Ragnar Posted July 18, 2008 Author Share Posted July 18, 2008 Re: Gym error: Fatal error: Maximum execution time of 60 seconds exceeded I can't find any hint of a loop. Here's the code. The crazy thing is, this only happens to one player. I've seen money gyms in other games where you pay way more than 15 million each time that don't spit out the error. (Think costing billions and trillions at 2452 games.) <?php $macropage="gym.php"; include "globals.php"; if($ir['hospital']) { die("This page cannot be accessed while in hospital."); } if($ir['location'] == 1) { die("You can only train here when you are in Viridian."); } if($ir['location'] == 2) { die("You can only train here when you are in Viridian."); } if($ir['location'] == 3) { die("You can only train here when you are in Viridian."); } if($ir['location'] == 4) { die("You can only train here when you are in Viridian."); } if($ir['location'] == 5) { die("You can only train here when you are in Viridian."); } if($ir['location'] == 7) { die("You can only train here when you are in Viridian."); } if($ir['location'] == 8) { die("You can only train here when you are in Viridian."); } if($ir['location'] == 10) { die("You can only train here when you are in Viridian."); } $statnames=array( 'Strength' => 'strength', 'Agility' => 'agility', 'Guard' => 'guard', 'IQ' => 'IQ', 'Labour' => 'labour'); $_POST['amnt']=($ir['will']*5*$ir['energy']); if(!$ir['jail']) { print "<h3>Viridian Gym</h3><hr />"; } else { print "<h3>Viridian Jail Gym</h3><hr />"; } if($_POST['stat'] && $_POST['amnt']) { $stat=$statnames[$_POST['stat']]; if(!$stat) { die("This stat cannot be trained."); } if($_POST['amnt'] > $ir['money']) { print("You do not have enough money to train that much.<hr />"); } else { $gain=0; for($i=0; $i<$_POST['amnt']; $i++) { $gain+=round(rand(1,3)/rand(800,1000)*rand(800,1000)*(($ir['will']+20)/150)); $ir['will']-=rand(1,3); if($ir['will'] < 0) { $ir['will']=0; } } if($ir['jail']) { $gain/=2; } $db->query("INSERT INTO trainlogs VALUES('',$userid,'$stat',$gain,unix_timestamp());",$c); $db->query("UPDATE `userstats` SET `{$stat}` = `{$stat}` + $gain WHERE `userid` = $userid"); $db->query("UPDATE `users` SET `will` = will - (({$ir['maxwill']})/100), money = money - {$_POST['amnt']} WHERE `userid` = $userid"); $db->query("UPDATE `users` SET `exp` = exp + {$ir['exp_needed']} / 100 WHERE `userid` = $userid AND `maxenergy` = {$_POST['amnt']}"); $inc=$ir[$stat]+$gain; $inc2=$ir['money']-$_POST['amnt']; if($stat=="strength") { print "You begin lifting some weights. You have gained {$gain} strength by doing {$_POST['amnt']} sets of weights. You now have {$inc} strength and {$inc2} money left."; } elseif($stat=="agility") { print "You begin running on a treadmill. You have gained {$gain} agility by doing {$_POST['amnt']} minutes of running. You now have {$inc} agility and {$inc2} money left."; } elseif($stat=="guard") { print "You jump into the pool and begin swimming. You have gained {$gain} guard by doing {$_POST['amnt']} minutes of swimming. You now have {$inc} guard and {$inc2} money left."; } elseif($stat=="IQ") { print "You spend time at Mario University. You have gained {$gain} IQ by spending {$_POST['amnt']} minutes there. You now have {$inc} IQ and {$inc2} money left."; } elseif($stat=="labour") { print "You walk over to some boxes filled with gym equipment and start moving them. You have gained {$gain} labour by moving {$_POST['amnt']} boxes. You now have {$inc} labour and {$inc2} money left."; } print "<hr />"; $ir[$stat]+=$gain; } } $ir['strank']=get_rank($ir['strength'],'strength'); $ir['agirank']=get_rank($ir['agility'],'agility'); $ir['guarank']=get_rank($ir['guard'],'guard'); $ir['labrank']=get_rank($ir['labour'],'labour'); $ir['IQrank']=get_rank($ir['IQ'],'IQ'); print "Choose the stat you want to train and the times you want to train it. You can train up to {$ir['energy']} times costing $ {$_POST['amnt']}.<hr /> <form action='viridiangym.php' method='post'> Stat: <select type='dropdown' name='stat'> <option value='Strength'>Strength (Have {$ir['strength']}, Ranked {$ir['strank']}) <option value='Agility'>Agility (Have {$ir['agility']}, Ranked {$ir['agirank']}) <option value='Guard'>Guard (Have {$ir['guard']}, Ranked {$ir['guarank']}) <option value='Labour'>Labour (Have {$ir['labour']}, Ranked {$ir['labrank']}) <option value='IQ'>IQ (Have {$ir['IQ']}, Ranked {$ir['IQrank']}) </select> Times to train: <input type='text' name='amnt' value='{$ir['energy']}' /> <input type='submit' value='Train' /></form>"; $h->endpage(); ?> Quote Link to comment Share on other sites More sharing options...
Floydian Posted July 18, 2008 Share Posted July 18, 2008 Re: Gym error: Fatal error: Maximum execution time of 60 seconds exceeded for($i=0; $i<$_POST['amnt']; $i++) { $gain+=round(rand(1,3)/rand(800,1000)*rand(800,1000)*(($ir['will']+20)/150)); $ir['will']-=rand(1,3); if($ir['will'] < 0) { $ir['will']=0; } } that's a loop my friend and if you loop through that a few million times, I could see it taking, oh, 10 minutes to complete perhaps Quote Link to comment Share on other sites More sharing options...
Ragnar Posted July 19, 2008 Author Share Posted July 19, 2008 Re: Gym error: Fatal error: Maximum execution time of 60 seconds exceeded Thanks a lot! for($i=0; $i<$_POST['amnt']; $i++) was doing it. If I get rid of that code, it's as if I got one energy (No loop.)! If I change it to for($i=0; $i<$ir['energy']; $i++) you gain about the same amount of stats for the same price, and it's MUCH faster, only looping your energy and not cash!!! Hundreds of loops is much better than millions!! Quote Link to comment Share on other sites More sharing options...
Floydian Posted July 19, 2008 Share Posted July 19, 2008 Re: Gym error: Fatal error: Maximum execution time of 60 seconds exceeded ;) I'm glad that worked out! 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.