_POST

BG_NIKE

Registered
..........
function printRow ($type)
{
global $users, $uera, $canbuild;
?>
<tr><td><?=$uera[$type]?></td>
<td class="aright"><?=commas($users[$type])?></td>
<td class="aright"><?=commas($canbuild)?></td>
<td class="aright"><input type="text" name="build[<?=$type?>]" size="5" value="0"></td></tr>
<?
}

function getBuildAmounts ()
{
global $users, $config, $urace, $buildcost, $buildrate, $canbuild;
$buildcost = round($config[buildings] + ($users[land] * 0.1));
$buildrate = $users[land] * 0.015 + 4;
$buildrate = round($urace[bpt] * $buildrate);
$canbuild = floor($users[cash] / $buildcost);
if ($canbuild > $buildrate * $users[turns])
$canbuild = $buildrate * $users[turns];
if ($canbuild > $users[freeland])
$canbuild = $users[freeland] / 2;
}

function buildStructures ($type, $cost)
{
global $users, $build, $totalbuild, $totalspent;
$amount = $build[$type];
fixInputNum($amount);
if ($amount < 0)
TheEnd("Не можеш да строиш с отрицателно число!");
$users[$type] += $amount;
$totalbuild += $amount;
$users[freeland] -= $amount;
$users[cash] -= $amount * $cost;
$totalspent += $amount * $cost;
}

getBuildAmounts();
if ($do_build)
{
............
Въпроса ми е как ще стане с това $do_build = $_POST['do_build']; пробрах какво ли не ($build[labs] = $_POST['build[labs'];),но не става.Мерси предварително.
 
Код:
function printRow ($type) 
{ 
global $users, $uera, $canbuild, $type; 
?> 
<tr><td><?=$uera[$type]?></td> 
<td class="aright"><?=commas($users[$type])?></td> 
<td class="aright"><?=commas($canbuild)?></td> 
<td class="aright"><input type="text" name="build[<?=$type?>]" size="5" value="0"></td></tr> 
<? 
} 

function getBuildAmounts () 
{ 
global $users, $config, $urace, $buildcost, $buildrate, $canbuild; 
$buildcost = round($config[buildings] + ($users[land] * 0.1)); 
$buildrate = $users[land] * 0.015 + 4; 
$buildrate = round($urace[bpt] * $buildrate); 
$canbuild = floor($users[cash] / $buildcost); 
if ($canbuild > $buildrate * $users[turns]) 
$canbuild = $buildrate * $users[turns]; 
if ($canbuild > $users[freeland]) 
$canbuild = $users[freeland] / 2; 
} 

function buildStructures ($type, $cost) 
{ 
global $users, $build, $totalbuild, $totalspent, $build[$type]; 
$amount = $build[$type]; 
fixInputNum($amount); 
if ($amount < 0) 
TheEnd("Не можеш да строиш с отрицателно число!"); 
$users[$type] += $amount; 
$totalbuild += $amount; 
$users[freeland] -= $amount; 
$users[cash] -= $amount * $cost; 
$totalspent += $amount * $cost; 
} 

getBuildAmounts(); 
if ($do_build) 
{
 
Parse error: syntax error, unexpected '[', expecting ',' or ';' in /opt/lampp/htdocs/game/phps/stroeji.php on line 52
global $users, $build, $totalbuild, $totalspent, $build[$type];
Само да споделя,че преди да спра register_globals всичко си работеше за това ми трябва _POST
 
ако не е проблем го направи така


function buildStructures ($type, $cost, $amount)
{
global $users, $build, $totalbuild, $totalspent;

fixInputNum($amount);
if ($amount < 0)
TheEnd("Не можеш да строиш с отрицателно число!");
$users[$type] += $amount;
$totalbuild += $amount;
$users[freeland] -= $amount;
$users[cash] -= $amount * $cost;
$totalspent += $amount * $cost;
}
 
jooorooo каза:
ако не е проблем го направи така


function buildStructures ($type, $cost, $amount)
{
global $users, $build, $totalbuild, $totalspent;

fixInputNum($amount);
if ($amount < 0)
TheEnd("Не можеш да строиш с отрицателно число!");
$users[$type] += $amount;
$totalbuild += $amount;
$users[freeland] -= $amount;
$users[cash] -= $amount * $cost;
$totalspent += $amount * $cost;
}


, $amount трябва да го задаваш там където ползваш функцията

buildStructures ($type, $cost, $build[$type])
 

Back
Горе