realmoflegends Posted May 17, 2011 Share Posted May 17, 2011 (edited) Hey all, This is the the cars mod given away by McCodes site, in the 'Tune' area. This section used to work just fine, but now gives these errors (nothing at all changed except hosting/PHP/MySQL version): Warning: Cannot use a scalar value as an array in tune.php on line 20 Warning: Cannot use a scalar value as an array in tune.php on line 21 Warning: Cannot use a scalar value as an array in tune.php on line 22 Warning: Cannot use a scalar value as an array in tune.php on line 23 Warning: Invalid argument supplied for foreach() in tune.php on line 37 Code section is here: <?php /*----------------------------------------------------- -- Mono Country v1.0 BETA -- A product of DBS-entertainment -- Copyright held 2005 by Dabomstew -- INDEX.php -----------------------------------------------------*/ function power($num1, $num2) { return pow($num1, $num2); } session_start(); include "globals.php"; print "<h3>The Enhancement and Upgrade Shoppe</h3><hr /> > <a href='garage.php'>Back To Race Track</a><hr />"; if(!$_GET['id']) { die("Invalid Usage"); } $q=mysql_query("SELECT cp.*,ct.* FROM cars_playercars cp LEFT JOIN cars_types ct ON ct.carID=cp.cpcCAR WHERE cp.cpcID={$_GET['id']} AND cp.cpcPLAYER=$userid", $c); if(mysql_num_rows($q) == 0) { die("Invalid Car"); } $r=mysql_fetch_array($q); $cost['acc']=$r['carACC']*power($r['cpcACCLV']+1,4)*($r['cpcACCLV']*$r['carACC']*2); $cost['han']=$r['carHAN']*power($r['cpcHANLV']+1,4)*($r['cpcHANLV']*$r['carHAN']*2); $cost['spd']=$r['carSPD']*power($r['cpcSPDLV']+1,4)*($r['cpcSPDLV']*$r['carSPD']*2); $cost['shd']=$r['carSHD']*power($r['cpcSHDLV']+1,4)*($r['cpcSHDLV']*$r['carSHD']*2); if($_GET['buy']) { if($_GET['buy'] != "acc" && $_GET['buy'] != "han" && $_GET['buy'] != "spd" && $_GET['buy'] != "shd") { die("Abusers suck."); } $upgr_cost=$cost[$_GET['buy']]; if($ir['money'] < $upgr_cost) { die("You don't have enough money to upgrade this stat."); } mysql_query("UPDATE users SET money=money-{$upgr_cost} WHERE userid=$userid", $c); $stat="cpc".strtoupper($_GET['buy'])."LV"; mysql_query("UPDATE cars_playercars SET $stat=$stat+1 WHERE cpcID={$_GET['id']}", $c); print "Upgrade Complete!<br /> > <a href='tune.php?id={$_GET['id']}'>Tune More</a>"; } else { foreach($cost as $k => $v) { $costf[$k]='$'.number_format($v); } $acc=$r['cpcACCLV']*$r['carACC']; $han=$r['cpcHANLV']*$r['carHAN']; $spd=$r['cpcSPDLV']*$r['carSPD']; $shd=$r['cpcSHDLV']*$r['carSHD']; Help would be greatly appreciated, and there may be a few dollars rewards money involved. 23 people viewed this, someone must know :D Edited May 17, 2011 by realmoflegends Quote Link to comment Share on other sites More sharing options...
Djkanna Posted May 18, 2011 Share Posted May 18, 2011 Line 19 add after it, $cost = array(); Quote Link to comment Share on other sites More sharing options...
realmoflegends Posted May 18, 2011 Author Share Posted May 18, 2011 I tried that, nothing. Turns out the array had to be rewritten/phased out in order to work, failed on several servers with older and newer PHP and MySQL versions (mccodes might want to make a note of this for the Car mod they have on their site, the 'Tune' part really doesn't work, at least anymore). 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.