function edit_item_form() { global $ir, $c, $h; $_POST['item'] = abs(@intval($_POST['item'])); $d = mysql_query("SELECT * FROM items WHERE itmid={$_POST['item']}", $c); if (mysql_num_rows($d) == 0) { print "There is no such item."; return; } $itemi = mysql_fetch_array($d); $f = mysql_query("SELECT * FROM food WHERE item_id={$_POST['item']}", $c); if (mysql_num_rows($f) > 0) { $a = mysql_fetch_array($f); $energy = $a['energy']; } else { $energy = 1; } $f = mysql_query("SELECT * FROM medical WHERE item_id={$_POST['item']}", $c); if (mysql_num_rows($f) > 0) { $a = mysql_fetch_array($f); $health = $a['health']; } else { $health = 10; } $f = mysql_query("SELECT * FROM weapons WHERE item_id={$_POST['item']}", $c); if (mysql_num_rows($f) > 0) { $a = mysql_fetch_array($f); $damage = $a['damage']; } else { $damage = 1; } $f = mysql_query("SELECT * FROM armour WHERE item_ID={$_POST['item']}", $c); if (mysql_num_rows($f) > 0) { $a = mysql_fetch_array($f); $def = $a['Defence']; } else { $def = 10; } print "<h3>Editing Item</h3>\n<form action='new_staff.php?action=edititemsub' method='post'>\n<input type='hidden' name='itmid' value='{$_POST['item']}' />\nItem Name: <input type='text' name='itmname' value='{$itemi['itmname']}' /><br />\nItem Desc.: <input type='text' name='itmdesc' value='{$itemi['itmdesc']}' /><br />\nItem Type: " . itemtype_dropdown($c, 'itmtype', $itemi['itmtype']) . "<br />\nItem Buyable: <input type='checkbox' name='itmbuyable'"; if ($itemi['itmbuyable']) { print " checked='checked'"; } print " /><br />\nItem Price: <input type='text' name='itmbuyprice' value='{$itemi['itmbuyprice']}' /><br />\nItem Sell Value: <input type='text' name='itmsellprice' value='{$itemi['itmsellprice']}'/><br /><br />\n<b>Specialized</b><br />\nItem Energy Regen (food only): <input type='text' name='energy' value='{$energy}' /><br />\nItem Health Regen (medical only): <input type='text' name='health' value='{$health}' /><br />\nPower (weapons only): <input type='text' name='damage' value='{$damage}' /><br />\nDamage Off (armor only): <input type='text' name='Defence' value='{$def}' /><br />\n<input type='submit' value='Edit Item' /></form>"; }
function edit_item_form() { global $db, $ir, $c, $h; if ($ir['user_level'] > 2) { die("403"); } $d = $db->query("SELECT * FROM items WHERE itmid={$_POST['item']}"); $itemi = $db->fetch_row($d); print "\n\n\n<div class='generalinfo_txt'>\n<div><img src='images/info_left.jpg' alt='' /></div>\n<div class='info_mid'><h2 style='padding-top:10px;'> Editing Item</h2></div>\n<div><img src='images/info_right.jpg' alt='' /></div> </div>\n<div class='generalinfo_simple'><br> <br><br>\n\n<form action='staff_items.php?action=edititemsub' method='post'>\n<input type='hidden' name='itmid' value='{$_POST['item']}' />\nItem Name: <input type='text' STYLE='color: black; background-color: white;' name='itmname' value='{$itemi['itmname']}' /><br />\nItem Desc.: <input type='text' STYLE='color: black; background-color: white;' name='itmdesc' value='{$itemi['itmdesc']}' /><br />\nItem Type: " . itemtype_dropdown($c, 'itmtype', $itemi['itmtype']) . "<br />\nItem Buyable: <input type='checkbox' name='itmbuyable'"; if ($itemi['itmbuyable']) { print " checked='checked'"; } print " /><br />Item Price: <input type='text' STYLE='color: black; background-color: white;' name='itmbuyprice' value='{$itemi['itmbuyprice']}' /><br />\nItem Sell Value: <input type='text' STYLE='color: black; background-color: white;' name='itmsellprice' value='{$itemi['itmsellprice']}' /><hr /><b>Usage Form</b><hr />"; $stats = array("energy" => "Energy", "will" => "Will", "brave" => "Brave", "hp" => "Health", "strength" => "Strength", "agility" => "Agility", "guard" => "Guard", "labour" => "Labour", "IQ" => "IQ", "hospital" => "Hospital Time", "jail" => "Jail Time", "money" => "Money", "crystals" => "Crystals", "cdays" => "Education Days Left", "bankmoney" => "Bank money", "cybermoney" => "Cyber money", "crimexp" => "Crime XP"); for ($i = 1; $i <= 3; $i++) { if ($itemi["effect" . $i]) { $efx = unserialize($itemi["effect" . $i]); } else { $efx = array("inc_amount" => 0); } $switch1 = $itemi['effect' . $i . '_on'] > 0 ? " checked='checked'" : ""; $switch2 = $itemi['effect' . $i . '_on'] > 0 ? "" : " checked='checked'"; print "<b><u>Effect {$i}</u></b><br />\nOn? <input type='radio' name='effect{$i}on' value='1'{$switch1} /> Yes <input type='radio' name='effect{$i}on' value='0'{$switch2} /> No<br />\nStat: <select name='effect{$i}stat' type='dropdown'>"; foreach ($stats as $k => $v) { if ($k == $efx['stat']) { print "<option value='{$k}' selected='selected'>{$v}</option>\n"; } else { print "<option value='{$k}'>{$v}</option>\n"; } } if ($efx['dir'] == "neg") { $str = "<option value='pos'>Increase</option><option value='neg' selected='selected'>Decrease</option>"; } else { $str = "<option value='pos' selected='selected'>Increase</option><option value='neg'>Decrease</option>"; } if ($efx['inc_type'] == "percent") { $str2 = "<option value='figure'>Value</option><option value='percent' selected='selected'>Percent</option>"; } else { $str2 = "<option value='figure' selected='selected'>Value</option><option value='percent'>Percent</option>"; } print "</select> Direction: <select name='effect{$i}dir' type='dropdown'>{$str}\n </select><br />\n Amount: <input type='text' STYLE='color: black; background-color: white;' name='effect{$i}amount' value='{$efx['inc_amount']}' /> <select name='effect{$i}type' type='dropdown'>{$str2}</select><hr />"; } print "<b>Combat Usage</b><br />\nWeapon Power: <input type='text' STYLE='color: black; background-color: white;' name='weapon' value='{$itemi['weapon']}' /><br />\nArmor Defense: <input type='text' STYLE='color: black; background-color: white;' name='armor' value='{$itemi['armor']}' /><hr />\n<input type='submit' STYLE='color: black; background-color: white;' value='Edit Item' /></form> </div><div><img src='images/generalinfo_btm.jpg' alt='' /></div><br></div></div></div></div></div> "; }