48,225,585,990,1575,2250,2790,3420,4230,5040,5850,6840,8010,9000,10350);
output("`&
Armor for %s Dragon Kills
`0",$armorlevel,true);
$armorarray=array(
"Armor,title",
"armorid"=>"Armor ID,hidden",
"armorname"=>"Armor Name",
"defense"=>"Defense,range,1,15,1");
$op = httpget('op');
$id = httpget('id');
if($op=="edit" || $op=="add"){
if ($op=="edit"){
$sql = "SELECT * FROM " . db_prefix("armor") . " WHERE armorid='$id'";
$result = db_query($sql);
$row = db_fetch_assoc($result);
}else{
$sql = "SELECT max(defense+1) AS defense FROM " . db_prefix("armor") . " WHERE level=$armorlevel";
$result = db_query($sql);
$row = db_fetch_assoc($result);
}
rawoutput("");
}else if($op=="del"){
$sql = "DELETE FROM " . db_prefix("armor") . " WHERE armorid='$id'";
db_query($sql);
//output($sql);
$op = "";
httpset("op", $op);
}else if($op=="save"){
$armorid = httppost('armorid');
$armorname = httppost('armorname');
$defense = httppost('defense');
if ($armorid>0){
$sql = "UPDATE " . db_prefix("armor") . " SET armorname=\"$armorname\",defense=\"$defense\",value=".$values[$defense]." WHERE armorid='$armorid'";
}else{
$sql = "INSERT INTO " . db_prefix("armor") . " (level,defense,armorname,value) VALUES ($armorlevel,\"$defense\",\"$armorname\",".$values[$defense].")";
}
db_query($sql);
$op = "";
httpset("op", $op);
}
if ($op==""){
$sql = "SELECT max(level+1) AS level FROM " . db_prefix("armor");
$res = db_query($sql);
$row = db_fetch_assoc($res);
$max = $row['level'];
for ($i=0;$i<=$max;$i++){
if ($i == 1)
addnav(array("Armor for %s DK",$i),"armoreditor.php?level=$i");
else
addnav(array("Armor for %s DKs",$i),"armoreditor.php?level=$i");
}
$sql = "SELECT * FROM " . db_prefix("armor") . " WHERE level=$armorlevel ORDER BY defense";
$result= db_query($sql);
$ops = translate_inline("Ops");
$name = translate_inline("Name");
$cost = translate_inline("Cost");
$defense = translate_inline("Defense");
$level = translate_inline("Level");
$edit = translate_inline("Edit");
$del = translate_inline("Del");
$delconfirm = translate_inline("Are you sure you wish to delete this armor?");
rawoutput("");
rawoutput("$ops | $name | $cost | $defense | $level |
");
$number=db_num_rows($result);
for ($i=0;$i<$number;$i++){
$row = db_fetch_assoc($result);
rawoutput("");
rawoutput("[$edit|$del] | ");
addnav("","armoreditor.php?op=edit&id={$row['armorid']}&level=$armorlevel");
addnav("","armoreditor.php?op=del&id={$row['armorid']}&level=$armorlevel");
rawoutput("");
output_notl($row['armorname']);
rawoutput(" | ");
output_notl($row['value']);
rawoutput(" | ");
output_notl($row['defense']);
rawoutput(" | ");
output_notl($row['level']);
rawoutput(" | ");
rawoutput("
");
}
rawoutput("
");
}
page_footer();
?>