Fix Marchand

Fix undefined value in options.php
This commit is contained in:
Loïc TALON 2013-02-24 19:01:04 +01:00
commit 6f1e5e4467
2 changed files with 13 additions and 17 deletions

View file

@ -39,13 +39,13 @@ function ModuleMarchand ( $CurrentUser, &$CurrentPlanet ) {
$parse = $lang;
if ($_POST['ress'] != '') {
if (isset($_POST['ress']) && $_POST['ress'] != '') {
$PageTPL = gettemplate('message_body');
$Error = false;
$CheatTry = false;
$Metal = $_POST['metal'];
$Crystal = $_POST['cristal'];
$Deuterium = $_POST['deut'];
$Metal = isset($_POST['metal']) ? $_POST['metal'] : 0;
$Crystal = isset($_POST['cristal']) ? $_POST['cristal'] : 0;
$Deuterium = isset($_POST['deut']) ? $_POST['deut'] : 0;
if ($Metal < 0) {
$Metal *= -1;
$CheatTry = true;
@ -72,8 +72,8 @@ function ModuleMarchand ( $CurrentUser, &$CurrentPlanet ) {
case 'cristal':
$Necessaire = (( $Metal * 0.5) + ( $Deuterium * 2));
if ($CurrentPlanet['crystal'] > $Necessaire) {
$CurrentPlanet['crystal'] -= $Necessaire;
if ($CurrentPlanet['cristal'] > $Necessaire) {
$CurrentPlanet['cristal'] -= $Necessaire;
} else {
$Message = $lang['mod_ma_noten'] ." ". $lang['Crystal'] ."! ";
$Error = true;
@ -94,17 +94,17 @@ function ModuleMarchand ( $CurrentUser, &$CurrentPlanet ) {
if ($Error == false) {
if ($CheatTry == true) {
$CurrentPlanet['metal'] = 0;
$CurrentPlanet['crystal'] = 0;
$CurrentPlanet['cristal'] = 0;
$CurrentPlanet['deuterium'] = 0;
} else {
$CurrentPlanet['metal'] += $Metal;
$CurrentPlanet['crystal'] += $Crystal;
$CurrentPlanet['cristal'] += $Crystal;
$CurrentPlanet['deuterium'] += $Deuterium;
}
$QryUpdatePlanet = "UPDATE {{table}} SET ";
$QryUpdatePlanet .= "`metal` = '". $CurrentPlanet['metal'] ."', ";
$QryUpdatePlanet .= "`crystal` = '". $CurrentPlanet['crystal'] ."', ";
$QryUpdatePlanet .= "`cristal` = '". $CurrentPlanet['cristal'] ."', ";
$QryUpdatePlanet .= "`deuterium` = '". $CurrentPlanet['deuterium'] ."' ";
$QryUpdatePlanet .= "WHERE ";
$QryUpdatePlanet .= "`id` = '". $CurrentPlanet['id'] ."';";
@ -118,7 +118,7 @@ function ModuleMarchand ( $CurrentUser, &$CurrentPlanet ) {
}
$parse['mes'] = $Message;
} else {
if ($_POST['action'] != 2) {
if (!isset($_POST['action']) || $_POST['action'] != 2) {
$PageTPL = gettemplate('marchand_main');
} else {
$parse['mod_ma_res'] = "1";
@ -145,8 +145,7 @@ function ModuleMarchand ( $CurrentUser, &$CurrentPlanet ) {
$Page = parsetemplate ( $PageTPL, $parse );
return $Page;
}
$Page = ModuleMarchand ( $user, $planetrow );
$Page = ModuleMarchand ( $user, $planet );
display ( $Page, $lang['mod_marchand'], true, '', false );
// -----------------------------------------------------------------------------------------------------------

View file

@ -61,7 +61,7 @@ $mode = isset($_GET['mode']) ? $_GET['mode'] : null;
// Gestion des options speciales pour les admins
if ($user['authlevel'] != LEVEL_PLAYER) {
if ($_POST['adm_pl_prot'] == 'on') {
if (isset($_POST['adm_pl_prot']) && $_POST['adm_pl_prot'] == 'on') {
doquery ("UPDATE {{table}} SET `id_level` = '".$user['authlevel']."' WHERE `id_owner` = '".$user['id']."';", 'planets');
} else {
doquery ("UPDATE {{table}} SET `id_level` = '0' WHERE `id_owner` = '".$user['id']."';", 'planets');
@ -191,10 +191,7 @@ $mode = isset($_GET['mode']) ? $_GET['mode'] : null;
`settings_bud` = '$settings_bud',
`settings_mis` = '$settings_mis',
`settings_rep` = '$settings_rep',
`db_deaktjava` = '$db_deaktjava',
`kolorminus` = '$kolorminus',
`kolorplus` = '$kolorplus',
`kolorpoziom` = '$kolorpoziom'
`db_deaktjava` = '$db_deaktjava'
WHERE `id` = '$iduser' LIMIT 1", "users");
if (isset($_POST["db_password"]) && md5($_POST["db_password"]) == $user["password"]) {