<?
include("config.php");
updatecookie();
include("languages/$lang");
$title=$l_ze_title;
connectdb();
if(checklogin())
die();
bigtitle();
$res = $db->Execute("SELECT * FROM $dbtables[zones] WHERE zone_id='$zone'");
if($res->EOF)
zoneedit_die($l_zi_nexist);
$curzone = $res->fields;
if($curzone[corp_zone] == 'N')
{
$result = $db->Execute("SELECT ship_id FROM $dbtables[ships] WHERE email='$username'");
$ownerinfo = $result->fields;
}
else
{
$result = $db->Execute("SELECT creator, id FROM $dbtables[teams] WHERE creator=$curzone[owner]");
$ownerinfo = $result->fields;
}
if(($curzone[corp_zone] == 'N' && $curzone[owner] != $ownerinfo[ship_id]) || ($curzone[corp_zone] == 'Y' && $curzone[owner] != $ownerinfo[id] && $row[owner] == $ownerinfo[creator]))
zoneedit_die($l_ze_notowner);
if($command == change)
zoneedit_change();
if($curzone[allow_beacon] == 'Y')
$ybeacon = "checked";
elseif($curzone[allow_beacon] == 'N')
$nbeacon = "checked";
else
$lbeacon = "checked";
if($curzone[allow_attack] == 'Y')
$yattack = "checked";
else
$nattack = "checked";
if($curzone[allow_warpedit] == 'Y')
$ywarpedit = "checked";
elseif($curzone[allow_warpedit] == 'N')
$nwarpedit = "checked";
else
$lwarpedit = "checked";
if($curzone[allow_planet] == 'Y')
$yplanet = "checked";
elseif($curzone[allow_planet] == 'N')
$nplanet = "checked";
else
$lplanet = "checked";
if($curzone[allow_trade] == 'Y')
$ytrade = "checked";
elseif($curzone[allow_trade] == 'N')
$ntrade = "checked";
else
$ltrade = "checked";
if($curzone[allow_defenses] == 'Y')
$ydefense = "checked";
elseif($curzone[allow_defenses] == 'N')
$ndefense = "checked";
else
$ldefense = "checked";
echo "<div id=\"updateDiv\">";
echo "<form id=\"commentsForm\">" .
"<table border=0><tr>" .
"<td align=right><font size=2><b>$l_ze_name : </b></font></td>" .
"<td><input type=text name=name size=30 maxlength=30 value=\"$curzone[zone_name]\"></td>" .
"</tr><tr>" .
"<td align=right><font size=2><b>$l_ze_allow $l_beacons : </b></font></td>" .
"<td><input type=radio name=beacons value=Y $ybeacon> $l_yes <input type=radio name=beacons value=N $nbeacon> $l_no <input type=radio name=beacons value=L $lbeacon> $l_zi_limit</td>" .
"</tr><tr>" .
"<td align=right><font size=2><b>$l_ze_attacks : </b></font></td>" .
"<td><input type=radio name=attacks value=Y $yattack> $l_yes <input type=radio name=attacks value=N $nattack> $l_no</td>" .
"</tr><tr>" .
"<td align=right><font size=2><b>$l_ze_allow $l_warpedit : </b></font></td>" .
"<td><input type=radio name=warpedits value=Y $ywarpedit> $l_yes <input type=radio name=warpedits value=N $nwarpedit> $l_no <input type=radio name=warpedits value=L $lwarpedit> $l_zi_limit</td>" .
"</tr><tr>" .
"<td align=right><font size=2><b>$l_allow $l_sector_def : </b></font></td>" .
"<td><input type=radio name=defenses value=Y $ydefense> $l_yes <input type=radio name=defenses value=N $ndefense> $l_no <input type=radio name=defenses value=L $ldefense> $l_zi_limit</td>" .
"</tr><tr>" .
"<td align=right><font size=2><b>$l_ze_genesis : </b></font></td>" .
"<td><input type=radio name=planets value=Y $yplanet> $l_yes <input type=radio name=planets value=N $nplanet> $l_no <input type=radio name=planets value=L $lplanet> $l_zi_limit</td>" .
"</tr><tr>" .
"<td align=right><font size=2><b>$l_allow $l_title_port : </b></font></td>" .
"<td><input type=radio name=trades value=Y $ytrade> $l_yes <input type=radio name=trades value=N $ntrade> $l_no <input type=radio name=trades value=L $ltrade> $l_zi_limit</td>" .
"</tr><tr>" .
"<td colspan=2 align=center><br>" .
"<input name=\"sendbutton\" type=\"button\" value=\"$l_submit\" onClick=\"formai('zoneedit', '?command=change&zone=$zone');\"></td></tr>" .
"</table>" .
"</form>";
echo "<a onClick=\"linx('zoneinfo', '?zone=$zone')\">$l_clickme</a> $l_ze_return.<p>";
TEXT_GOTOMAIN();
//-----------------------------------------------------------------
function zoneedit_change()
{
global $zone;
global $name;
global $beacons;
global $attacks;
global $warpedits;
global $planets;
global $trades;
global $defenses;
global $l_clickme, $l_ze_saved, $l_ze_return;
global $db,$dbtables;
if(!get_magic_quotes_gpc())
$name = addslashes($name);
$db->Execute("UPDATE $dbtables[zones] SET zone_name='$name', allow_beacon='$beacons', allow_attack='$attacks', allow_warpedit='$warpedits', allow_planet='$planets', allow_trade='$trades', allow_defenses='$defenses' WHERE zone_id=$zone");
echo "$l_ze_saved<p>";
echo "<a onClick=\"linx('zoneinfo', '?zone=$zone')\">$l_clickme</a> $l_ze_return.<p>";
TEXT_GOTOMAIN();
die();
}
function zoneedit_die($error_msg)
{
echo "<p>$error_msg<p>";
die();
}
?>