escape(trim($_POST['item_name'])); $item_description = $db->escape(trim($_POST['item_description'])); $item_price = intval($_POST['item_price']); $item_quantity = intval($_POST['item_quantity']); $item_rarity = intval($_POST['item_rarity']); $item_image = $db->escape(trim($_POST['item_image'])); if (strlen($item_name) == 0) message('Items need names, you know.'); if (strlen($item_description) == 0) message('Items need some info or you don\'t know what it is.'); if ($item_price < 0) message('You can\'t sell an item for less than 0 '.$pun_config['cm_cur_name'].'.'); if ($item_quantity < 0) message('You can\'t have a negative number of an item in the shop.'); if ($item_rarity < 0) message('An item may not have a negative rarity.'); if (strlen($item_image) == 0) message('An image might be handy.'); $db->query('INSERT INTO '.$db->prefix.'items (item_name, description, item_cost, item_quantity, item_rarity, item_image) VALUES ("'.$item_name.'", "'.$item_description.'", '.$item_price.', '.$item_quantity.', '.$item_rarity.', "'.$item_image.'")') or error('Unable to add new item', __FILE__, __LINE__, $db->error()); redirect($_SERVER['REQUEST_URI'], 'Item added. Redirecting …'); } else if (isset($_POST['update_items'])) { while (list($item_id, $item_info) = @each($_POST['item'])) { $item_price = intval($item_info['item_price']); $item_description = $db->escape(trim($item_info['item_description'])); $item_quantity = intval($item_info['item_quantity']); $item_rarity = intval($item_info['item_rarity']); $item_image = trim($item_info['item_image']); if ($item_description < 0) message('You should add info so everyone knows what it is.'); if ($item_price < 0) message('You can\'t sell an item for less than 0 '.$pun_config['cm_cur_name'].'.'); if ($item_quantity < 0) message('You can\'t have a negative number of an item in the shop.'); if ($item_rarity < 0) message('An item may not have a negative rarity.'); $db->query('UPDATE '.$db->prefix.'items SET description="'.$item_description.'", item_cost='.$item_price.', item_quantity='.$item_quantity.', item_rarity='.$item_rarity.' WHERE item_id='.intval($item_id)) or error('Unable to update item', __FILE__, __LINE__, $db->error()); } redirect($_SERVER['REQUEST_URI'], 'Items updated. Redirecting …'); } else { // Display the admin navigation menu generate_admin_menu($plugin); ?>

Add item

Create a new item
Item Image The image for this item.
Item Name The name for the new item you are creating.
Item Description The info for the new item you are creating.
Item Price The price for the new item you are creating.
Item Quantity The quantity of the new item you are creating.
Item Rarity The rarity of new item you are creating.

query('SELECT '.$db->prefix.'items.* FROM '.$db->prefix.'items ORDER BY item_name') or error('Unable to fetch item list', __FILE__, __LINE__, $db->error()); if ($db->num_rows($result) > 0) { ?>

Edit items

Item List:
fetch_assoc($result)) { ?>
Description     Price   Quantity     Rarity     Image  

Upload Image

$file_array) { if (is_uploaded_file($file_array['tmp_name'])) { move_uploaded_file($file_array['tmp_name'], $file_dir.'/'.$file_array['name']) or die("Couldn't copy."); } } ?>
Image Upload

File to upload: