It is set up for registered users, cause you cannot buy anything without money.

Anyway. I need help to finish this because I am not that good of a coder, I was able to get this far with Smarty and Mark helping out off and on to fix some of the stuff or write up parts that I didn't know how to do. So To finish all of this I need at least one or two people that know how to code well enough to finish the category part so that I can throw this in a zip for everyone.

The sooner that it is done the better.

OK, for some reason none of us can find the thread that was put up months ago about the Item Shop mod that people were wanting. I will just post another topic here in punbb about it then.

This is a stand alone mod that works with the cash mod, you must have the cash mod enabled/working on your forum for the item shop to function properly.

WARNING:
Now, this is NOT A FINISHED PROJECT.

It is missing the final part of the category feature with pagenating and ordering. However, the included list is what has already been done AND tested for errors and bugs.

Install Mod:

<?php
/***********************************************************************/

// Some info about your mod.
$mod_title      = 'Shop/Item Mod';
$mod_version    = '1.5';
$release_date   = '3/14/2008';
$author         = 'Smartys, Lunactic Inferno, Mark';
$author_email   = 'smartys@punbb.org, LunacticInferno@gmail.com, Mark@sharingyour.info';

// Versions of PunBB this mod was created for.
$punbb_versions    = array('1.2', '1.2.1', '1.2.2', '1.2.3', '1.2.4', '1.2.5', '1.2.6', '1.2.7', '1.2.8', '1.2.9', '1.2.10', '1.2.11', '1.2.12', '1.2.13', '1.2.14', '1.2.15', '1.2.16', '1.2.17');

// Set this to false if you haven't implemented the restore function (see below)
$mod_restore    = false;

// This following function will be called when the user presses the "Install" button
function install()
{
    global $db, $db_type, $pun_config;

    switch ($db_type)
    {
        case 'mysql':
        case 'mysqli':
            $sql = 'CREATE TABLE '.$db->prefix.'items (
            item_id INT(10) UNSIGNED NOT NULL AUTO_INCREMENT,
            item_name VARCHAR(255) NOT NULL DEFAULT "New item",
            description TEXT NOT NULL,
            item_cost INT(10) UNSIGNED NOT NULL DEFAULT 0,
            item_quantity INT(10) UNSIGNED NOT NULL DEFAULT 0,
            item_rarity INT(10) UNSIGNED NOT NULL DEFAULT 1,
            item_image VARCHAR(255) NOT NULL,
            PRIMARY KEY(item_id)
            ) ENGINE=MyISAM';
            break;

        case 'pgsql':
            $sql = 'CREATE TABLE '.$db->prefix.'items (
            item_id SERIAL,
            item_name VARCHAR(255) NOT NULL DEFAULT "New item",
            description TEXT NOT NULL,
            item_cost INT NOT NULL DEFAULT 0,
            item_quantity INT NOT NULL DEFAULT 0,
            item_rarity INT NOT NULL DEFAULT 1,
            item_image VARCHAR(255) NOT NULL,
            PRIMARY KEY(item_id)
            )';
            break;

        case 'sqlite':
            $sql = 'CREATE TABLE '.$db->prefix.'items (
            item_id INTEGER NOT NULL,
            item_name VARCHAR(255) NOT NULL DEFAULT "New item",
            description TEXT NOT NULL,
            item_cost INTEGER NOT NULL DEFAULT 0,
            item_quantity INTEGER NOT NULL DEFAULT 0,
            item_rarity INTEGER NOT NULL DEFAULT 1,
            item_image VARCHAR(255) NOT NULL,
            PRIMARY KEY(item_id)
            )';
            break;
    }
    $db->query($sql) or error('Unable to create items table', __FILE__, __LINE__, $db->error());

    switch ($db_type)
    {
        case 'mysql':
        case 'mysqli':
            $sql = 'CREATE TABLE '.$db->prefix.'inventory (
            item_id INT(10) UNSIGNED NOT NULL DEFAULT 0,
            user_id INT(10) UNSIGNED NOT NULL DEFAULT 0,
            quantity INT(10) UNSIGNED NOT NULL DEFAULT 0,
            description TEXT NOT NULL,
            PRIMARY KEY(item_id, user_id)
            ) ENGINE=MyISAM';
            break;

        case 'pgsql':
            $sql = 'CREATE TABLE '.$db->prefix.'inventory (
            item_id INT NOT NULL DEFAULT 0,
            user_id INT NOT NULL DEFAULT 0,
            quantity INT NOT NULL DEFAULT 0,
            description TEXT NOT NULL,
            PRIMARY KEY(item_id, user_id)
            )';
            break;

        case 'sqlite':
            $sql = 'CREATE TABLE '.$db->prefix.'inventory (
            item_id INTEGER NOT NULL DEFAULT 0,
            user_id INTEGER NOT NULL DEFAULT 0,
            quantity INTEGER NOT NULL DEFAULT 0,
            description TEXT NOT NULL,
            PRIMARY KEY(item_id, user_id)
            )';
            break;
    }
    $db->query($sql) or error('Unable to create items table', __FILE__, __LINE__, $db->error());
}


/***********************************************************************/

// DO NOT EDIT ANYTHING BELOW THIS LINE!


// Circumvent maintenance mode
define('PUN_TURN_OFF_MAINT', 1);
define('PUN_ROOT', './');
require PUN_ROOT.'include/common.php';

// We want the complete error message if the script fails
if (!defined('PUN_DEBUG'))
    define('PUN_DEBUG', 1);

// Make sure we are running a PunBB version that this mod works with
$version_warning = false;
if(!in_array($pun_config['o_cur_version'], $punbb_versions))
{
    foreach ($punbb_versions as $temp)
    {
        if (substr($temp, 0, 3) == substr($pun_config['o_cur_version'], 0, 3))
        {
            $version_warning = true;
            break;
        }
    }

    if (!$version_warning)
        exit('You are running a version of PunBB ('.$pun_config['o_cur_version'].') that this mod does not support. This mod supports PunBB versions: '.implode(', ', $punbb_versions));
}


$style = (isset($cur_user)) ? $cur_user['style'] : $pun_config['o_default_style'];

?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title><?php echo $mod_title ?> installation</title>
<link rel="stylesheet" type="text/css" href="style/<?php echo $pun_config['o_default_style'].'.css' ?>" />
</head>
<body>

<div id="punwrap">
<div id="puninstall" class="pun" style="margin: 10% 20% auto 20%">

<?php

if (isset($_POST['form_sent']))
{
    if (isset($_POST['install']))
    {
        // Run the install function (defined above)
        install();

?>
<div class="block">
    <h2><span>Installation successful</span></h2>
    <div class="box">
        <div class="inbox">
            <p>Your database has been successfully prepared for <?php echo pun_htmlspecialchars($mod_title) ?>. See readme.txt for further instructions.</p>
        </div>
    </div>
</div>
<?php

    }
    else
    {
        // Run the restore function (defined above)
        restore();

?>
<div class="block">
    <h2><span>Restore successful</span></h2>
    <div class="box">
        <div class="inbox">
            <p>Your database has been successfully restored.</p>
        </div>
    </div>
</div>
<?php

    }
}
else
{

?>
<div class="blockform">
    <h2><span>Mod installation</span></h2>
    <div class="box">
        <form method="post" action="<?php echo $_SERVER['PHP_SELF'] ?>?foo=bar">
            <div><input type="hidden" name="form_sent" value="1" /></div>
            <div class="inform">
                <p>This script will update your database to work with the following modification:</p>
                <p><strong>Mod title:</strong> <?php echo pun_htmlspecialchars($mod_title).' '.$mod_version ?></p>
                <p><strong>Author:</strong> <?php echo pun_htmlspecialchars($author) ?> (<a href="mailto:<?php echo pun_htmlspecialchars($author_email) ?>"><?php echo pun_htmlspecialchars($author_email) ?></a>)</p>
                <p><strong>Disclaimer:</strong> Mods are not officially supported by PunBB. Mods generally can't be uninstalled without running SQL queries manually against the database. Make backups of all data you deem necessary before installing.</p>
<?php if ($mod_restore): ?>                <p>If you've previously installed this mod and would like to uninstall it, you can click the restore button below to restore the database.</p>
<?php endif; ?><?php if ($version_warning): ?>                <p style="color: #a00"><strong>Warning:</strong> The mod you are about to install was not made specifically to support your current version of PunBB (<?php echo $pun_config['o_cur_version']; ?>). However, in most cases this is not a problem and the mod will most likely work with your version as well. If you are uncertain about installning the mod due to this potential version conflict, contact the mod author.</p>
<?php endif; ?>            </div>
            <p><input type="submit" name="install" value="Install" /><?php if ($mod_restore): ?><input type="submit" name="restore" value="Restore" /><?php endif; ?></p>
        </form>
    </div>
</div>
<?php

}

?>

</div>
</div>

</body>
</html>

Items Page:

<?php
define('PUN_ROOT', './');
require PUN_ROOT.'include/common.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/cash.php';

if ($pun_user['is_guest'])
    message($lang_common['No view']);

if (isset($_POST['form_sent']))
{
    $items = isset($_POST['item']) && is_array($_POST['item']) ? $_POST['item'] : array();
    $deduct_cash = 0;
    $deduct_quantity = array();
    $sql = array();

    foreach ($items as $item_id => $to_buy)
    {
        if ($to_buy > 0)
        {
            $result = $db->query('SELECT item_name, item_quantity, item_cost FROM '.$db->prefix.'items WHERE item_id = '.$item_id) or error('Unable to fetch item information', __FILE__, __LINE__, $db->error());

            if ($db->num_rows($result) > 0)
            {
                $item_info = $db->fetch_assoc($result);

                if ($to_buy > $item_info['item_quantity'])
                    message('You can not buy '.$to_buy.' '.pun_htmlspecialchars($item_info['item_name']).'(s): there is/are only '.$item_info['item_quantity'].' left!');

                if (($to_buy * $item_info['item_cost']) > $pun_user['cm_cash'])
                    message('You don\'t have enough '.pun_htmlspecialchars($pun_config['cm_cur_name']).' to buy '.$to_buy.' '.pun_htmlspecialchars($item_info['item_name']).'.');
            
                $sql[] = '('.$item_id.', '.$pun_user['id'].', '.$to_buy.')';

                $deduct_cash += $to_buy * $item_info['item_cost'];
            }
            else
            {
                message($lang_common['Bad request']);
            }
        }
    }

    // If we're here, all of the items are valid to buy
    foreach ($items as $item_id => $to_buy)
    {
        $db->query('UPDATE '.$db->prefix.'items set item_quantity = item_quantity - '.$to_buy.' WHERE item_id = '.$item_id) or error('Unable to deduct item from store', __FILE__, __LINE__, $db->error());
    }

    $db->query('UPDATE '.$db->prefix.'users SET cm_cash = cm_cash - '.$deduct_cash.' WHERE id = '.$pun_user['id']) or error('Unable to deduct cash', __FILE__, __LINE__, $db->error());

    $db->query('INSERT INTO '.$db->prefix.'inventory (item_id, user_id, quantity) VALUES '.implode(',', $sql).' ON DUPLICATE KEY UPDATE quantity = quantity + VALUES(quantity)') or error('Unable to add items to inventory', __FILE__, __LINE__, $db->error());

    redirect($_SERVER['REQUEST_URI'], 'Items purchased. Redirecting …');
}

$page_title = pun_htmlspecialchars($pun_config['o_board_title'].' - Shop');
define('PUN_ALLOW_INDEX', 1);
require PUN_ROOT.'header.php';

?>
<div class="block">
    <div class="box">
        <div class="inbox">
<p><strong>If you are looking to buy user account changes, then please go to the <a href="shop.php">Shop</a> which will sell these to you. This section is for Chibis, Edible Items, and Misc Items.</strong></p>
        </div>
    </div>
</div>
        <div class="blocktable">
            <h2><span>Buy some items</span></h2>
            <div class="box">
                    <div class="inbox">
                        <form method="post" action="<?php echo $_SERVER['REQUEST_URI'] ?>">
                        <input type="hidden" name="form_sent" value="1" />
                            <div class="inform">
                                <table cellspacing="0">
                                    <thead>
                                        <tr>
                                            <th class="tc2" scope="col">Image</th>
                                               <th class="tcl" scope="col">Item Name</th>
                                            <th class="tc2" scope="col">Price</th>
                                            <th class="tc3" scope="col">Rarity</th>
                                            <th class="tc3" scope="col">Quantity Remaining</th>
                                            <th class="tcr" scope="col">Number to Buy</th>
                                        </tr>
                                    </thead>
                                    <tbody>
<?php

// Display all the categories and forums
$result = $db->query('SELECT * FROM '.$db->prefix.'items') or error('Unable to fetch item list', __FILE__, __LINE__, $db->error());

while ($cur_item = $db->fetch_assoc($result))
{

?>
                                        <tr>
                                            <td class="tc2"><img src="img/items/<?php echo pun_htmlspecialchars($cur_item['item_image']) ?>" alt="<?php echo pun_htmlspecialchars($cur_item['item_name']) ?>"/>
                                            <td class="tcl"><strong><?php echo pun_htmlspecialchars($cur_item['item_name']) ?></strong><br/><br/><em><?php echo pun_htmlspecialchars($cur_item['description']) ?></em></td>
                                            <td class="tc2"><?php echo $cur_item['item_cost'] ?> <?php echo pun_htmlspecialchars($pun_config['cm_cur_name']) ?></td>
                                            <td class="tc3"><?php echo $cur_item['item_rarity'] ?></td>
                                            <td class="tc3"><?php echo $cur_item['item_quantity'] ?></td>
                                            <td class="tcr"><input type="text" name="item[<?php echo $cur_item['item_id'] ?>]" value="0" /></td>
                                        </tr>
<?php

}

?>
                                    </tbody>
                                </table>
                            </div>
                            <p class="submitend"><input type="submit" name="buy" value="Buy selected items" /></p>
                        </form>
                    </div>
            </div>
        </div>
<?php

require PUN_ROOT.'footer.php';

Inventory Page:

<?php
define('PUN_ROOT', './');
require PUN_ROOT.'include/common.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/cash.php';

if ($pun_user['is_guest'])
    message($lang_common['No view']);

if (isset($_POST['throw']) || isset($_POST['throwall']) ||isset($_POST['giveto']))
{
    $iid = round($_POST['iid']);

    $result = $db->query('SELECT inv.item_id, inv.quantity, it.item_name, it.item_rarity, it.item_image FROM '.$db->prefix.'inventory AS inv INNER JOIN '.$db->prefix.'items AS it ON (it.item_id=inv.item_id) WHERE user_id='.$pun_user['id'].' and inv.item_id='.$iid) or error('Unable to fetch item list', __FILE__, __LINE__, $db->error());
    if ($db->num_rows($result) == 0)
        message($lang_common['Bad request']);

    $cur_item = $db->fetch_assoc($result);

    if (isset($_POST['throw']))
    {
        $db->query('UPDATE '.$db->prefix.'inventory SET quantity=quantity-1 WHERE item_id='.$iid.' and user_id='.$pun_user['id']) or error('Unable to throw away', __FILE__, __LINE__, $db->error());

        if ($cur_item['quantity'] == 1)
            $db->query('DELETE FROM '.$db->prefix.'inventory WHERE item_id='.$iid.' and user_id='.$pun_user['id']) or error('Unable to throw away item.', __FILE__, __LINE__, $db->error());

        redirect($_SERVER['REQUEST_URI'], 'You have thrown away your item.');
    }
    else if (isset($_POST['throwall']))
    {
        $db->query('DELETE FROM '.$db->prefix.'inventory WHERE item_id='.$iid.' and user_id='.$pun_user['id']) or error('Unable to throw away item.', __FILE__, __LINE__, $db->error());
        redirect($_SERVER['REQUEST_URI'], 'You have thrown away your item.');
    }
    else if (isset($_POST['giveto']))
    {
        $result = $db->query('SELECT id, username FROM '.$db->prefix.'users WHERE username=\''.$db->escape($_POST['username']).'\'') or error('Unable to find user.', __FILE__, __LINE__, $db->error());
        if ($db->num_rows($result) == 0)
            message('This user does not exist.');

        $user = $db->fetch_assoc($result);

        $db->query('INSERT INTO '.$db->prefix.'inventory (item_id, user_id, quantity) VALUES ('.$iid.', '.$user['id'].', 1) ON DUPLICATE KEY UPDATE quantity = quantity + VALUES(quantity)') or error('Unable to add items to inventory', __FILE__, __LINE__, $db->error());
        $db->query('UPDATE '.$db->prefix.'inventory SET quantity=quantity-1 WHERE item_id='.$iid.' and user_id='.$pun_user['id']) or error('Unable to remove item from user', __FILE__, __LINE__, $db->error());

        if ($cur_item['quantity'] == 1)
            $db->query('DELETE FROM '.$db->prefix.'inventory WHERE item_id='.$iid.' and user_id='.$pun_user['id']) or error('Unable to delete from inventory', __FILE__, __LINE__, $db->error());
    
        $message = 'I have given you a '.$cur_item['item_name'].' because I am so kind and thought you deserve it for all your hard work.';
        $db->query('INSERT INTO '.$db->prefix.'messages (owner, subject, message, sender, sender_id, sender_ip, smileys, showed, status, posted) VALUES(
            \''.$user['id'].'\',
            \''.$db->escape($cur_item['item_name']).'\',
            \''.$db->escape($message).'\',
            \''.$db->escape($pun_user['username']).'\',
            \''.$pun_user['id'].'\',
            \''.get_remote_address().'\',
            \''.$smilies.'\',
            \'0\',
            \'0\',
            \''.time().'\'
        )') or error('Unable to send message', __FILE__, __LINE__, $db->error());
        
        redirect($_SERVER['REQUEST_URI'], 'You have given your item to '.$user['username']);
    }
}

$page_title = pun_htmlspecialchars($pun_config['o_board_title'].' - Inventory');
define('PUN_ALLOW_INDEX', 1);
require PUN_ROOT.'header.php';

?>

        <div class="blocktable">
            <h2><span>Your inventory</span></h2>
            <div class="box">
                    <div class="inbox">
                        <table cellspacing="0">
                            <thead>
                                <tr>
                                    <th class="tc3" scope="col">Image</th>
                                    <th class="tcl" scope="col">Item Name</th>
                                    <th class="tc2" scope="col">Rarity</th>
                                    <th class="tc3" scope="col">Quantity Owned</th>
                                    <th class="tcr" scope="col">Actions</th>
                                </tr>
                            </thead>
                            <tbody>
<?php



// Display all the categories and forums
$result = $db->query('SELECT inv.item_id, inv.quantity, it.item_name,it.description, it.item_rarity, it.item_image FROM '.$db->prefix.'inventory AS inv INNER JOIN '.$db->prefix.'items AS it ON (it.item_id=inv.item_id) WHERE user_id='.$pun_user['id'].' ORDER BY item_name') or error('Unable to fetch item list', __FILE__, __LINE__, $db->error());

while ($cur_item = $db->fetch_assoc($result))
{

?>
                                <tr>
                                    <td class="tc2"><img src="img/items/<?php echo pun_htmlspecialchars($cur_item['item_image']) ?>" alt="<?php echo pun_htmlspecialchars($cur_item['item_name']) ?>"/></td>
                                    <td class="tcl"><strong><?php echo pun_htmlspecialchars($cur_item['item_name']) ?></strong><br/><br/><em><?php echo pun_htmlspecialchars($cur_item['description']) ?></em></td>
                                    <td class="tc3"><?php echo $cur_item['item_rarity'] ?></td>
                                    <td class="tc3"><?php echo $cur_item['quantity'] ?></td>
                                    <td class="tcr"><form name="action" action="<?php echo 'http://'.$_SERVER['HTTP_HOST'].$_SERVER['REQUEST_URI']; ?>" method="post">
                                      <p>
                                        <input type="hidden" value="<?php echo $cur_item['item_id']; ?>" name="iid" />
                                        <input type="submit" name="throw" value="Throw away" /><br />
                                        <input type="submit" name="throwall" value="Throw away all" /><br />
                                        <input type="submit" name="giveto" value="Give to" /> 
                                        <input type="text" name="username" value="<?php echo $user['username']; ?>" />
                                        </p>
                                    </form></td>
                                </tr>
<?php

}

?>
                            </tbody>
                        </table>
                    </div>
            </div>
        </div>
<?php

require PUN_ROOT.'footer.php';

AP Items:

<?php
// Make sure no one attempts to run this script "directly"
if (!defined('PUN'))
    exit;

// Tell admin_loader.php that this is indeed a plugin and that it is loaded
define('PUN_PLUGIN_LOADED', 1);

if (isset($_POST['add_item']))
{
    $item_name = $db->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 = $db->escape(trim($item_info['item_image']));
        
        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.');
        
        $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);

?>
    <div class="blockform">
        <h2><span>Add item</span></h2>
        <div class="box">
            <form method="post" action="<?php echo $_SERVER['REQUEST_URI'] ?>">
                <div class="inform">
                    <fieldset>
                        <legend>Create a new item</legend>
                        <div class="infldset">
                            <table class="aligntop" cellspacing="0">
                                <tr>
                                    <th scope="row">Item Image</th>
                                    <td>
                                        <input type="text" name="item_image" size="30" maxlength="255" />
                                        <span>The image for this item.</span>
                                    </td>
                                </tr>
                                <tr>
                                    <th scope="row">Item Name</th>
                                    <td>
                                        <input type="text" name="item_name" size="30" maxlength="255" />
                                        <span>The name for the new item you are creating.</span>
                                    </td>
                                </tr>
                                <th scope="row">Item Description</th>
                                    <td>
                                        <input type="text" name="item_description" size="20" maxlength="400" />
                                        <span>The info for the new item you are creating.</span>
                                    </td>
                                </tr>
                                <tr>
                                    <th scope="row">Item Price</th>
                                    <td>
                                        <input type="text" name="item_price" size="8" maxlength="8" />
                                        <span>The price for the new item you are creating.</span>
                                    </td>
                                </tr>
                                <tr>
                                    <th scope="row">Item Quantity</th>
                                    <td>
                                        <input type="text" name="item_quantity" value="1" size="3" maxlength="4" />
                                        <span>The quantity of the new item you are creating.</span>
                                    </td>
                                </tr>
                                <tr>
                                    <th scope="row">Item Rarity</th>
                                    <td>
                                        <input type="text" name="item_rarity" value="1" size="3" maxlength="3" />
                                        <span>The rarity of new item you are creating.</span>
                                    </td>
                                </tr>
                            </table>
                        </div>
                    </fieldset>
                </div>
                <p class="submitend"><input type="submit" name="add_item" value="Add" tabindex="<?php echo $tabindex_count ?>" /></p>
            </form>
        </div>
<?php

    // Display all the categories and forums
    $result = $db->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)
    {

?>
        <h2 class="block2"><span>Edit items</span></h2>
        <div class="box">
            <form method="post" action="<?php echo $_SERVER['REQUEST_URI'] ?>">
                <p class="submittop"><input type="submit" name="update_items" value="Update positions" tabindex="3" /></p>
                <div class="inform">
                    <fieldset>
                        <legend>Item List:</legend>
                        <div class="infldset">
                            <table cellspacing="0">
<?php

    $tabindex_count = 4;

    while ($cur_item = $db->fetch_assoc($result))
    {

?>
                                <tr>
                                    <th><?php echo pun_htmlspecialchars($cur_item['item_name']) ?></th>
                                    <td>
                                        Description  <input type="text" name="item[<?php echo $cur_item['item_id'] ?>][item_description]" size="8" maxlength="400" value="<?php echo $cur_item['description'] ?>" tabindex="<?php echo $tabindex_count++ ?>" />
                                          Price<input type="text" name="item[<?php echo $cur_item['item_id'] ?>][item_price]" size="8" maxlength="8" value="<?php echo $cur_item['item_cost'] ?>" tabindex="<?php echo $tabindex_count++ ?>" />
                                          Quantity  <input type="text" name="item[<?php echo $cur_item['item_id'] ?>][item_quantity]" size="3" maxlength="4" value="<?php echo $cur_item['item_quantity'] ?>" tabindex="<?php echo $tabindex_count++ ?>" />
                                          Rarity  <input type="text" name="item[<?php echo $cur_item['item_id'] ?>][item_rarity]" size="3" maxlength="3" value="<?php echo $cur_item['item_rarity'] ?>" tabindex="<?php echo $tabindex_count++ ?>" />
                                          Image  <?php echo pun_htmlspecialchars($cur_item['item_image']) ?>
                                    </td>
                                </tr>
<?php

    }

?>
                            </table>
                        </div>
                    </fieldset>
                </div>
                <p class="submitend"><input type="submit" name="update_items" value="Update items" tabindex="<?php echo $tabindex_count++ ?>" /></p>
            </form>
        </div>
        <h2 class="block2"><span>Upload Image</span></h2>
        <div class="box">
        <?php
        $file_dir = "img/items/";
        foreach($_FILES as $file_name => $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.");
            }
        }
        ?>
        
            <form method="post" action="<?php echo $_SERVER['REQUEST_URI'] ?>" enctype="multipart/form-data">
            <input type="hidden" name="MAX_FILE_SIZE" value="51200" />
                  <div class="inform">
                    <fieldset>
                        <legend>Image Upload</legend>
                        <div class="infldset">
                        <p><strong>File to upload:</strong>
                        <input type="file" name="fileupload" /></p>                            
                        </div>
                    </fieldset>
                </div>
                <p class="submitend"><input type="submit" name="upload_image" value="Upload Image" tabindex="<?php echo $tabindex_count++ ?>" /></p>
            </form>
        </div>
    </div>
<?php

    }
}

The finished portions include the following:

AP_Items -
Item Creation
Name, Description, Rank, Quantity, Price and Image.

Item Editing
Description change, amount change, quantity change, and rank change.  (At the time there is no ability to change the item image, we were not sure if we should have the image change allowed yet or not.)

Item Image Uploader
This allows you to upload an image for your items that you specified a name for. The default database is img/items as the directory.

Item Page -
Displaying created images, and the ability to buy the images.  (At this time they are displayed in a random order, and there is no page cut off feature...)

Inventory Page -
A list of your 'bought' items for your personal inventory with the ability to Throw Away the item, Throw all of THAT item away, and giving the item to someone.

When you give the item away to someone they receive a private message (if your private message feature is enabled/set up correctly) that they have gotten an item from you and what that item is.

Install_Mod -

This page has all of the categories defined to be installed into your sql database for your forum.
______________________________________________________________________________________________

These are the things needing to be finished:

Category feature with ordering defined and pagenating defined.

This is an overview of what is NEEDED for the specific pages:

Install_Mod -
Category database defined for the sql database.

AP_Items -

Category code created that needs the following overview.
Create Category:
Category Name (to be created) and a checkbox list of these items to be defined (See Inventory.php for detail on this) Eat, Use, Mix, Forge, Open, Drink.

These six "actions" are basic actions that may be used in an rpg or action scripted project later to come. By creating, in example, a category named Foods you may want to "check" the actions "eat" and "mix". For weapons you may want "Forge" or "Fix".

Edit Items -
There needs to be a drop down box added to the edit items code so that you can select a category for an item to be displayed. That way, any item that is not given a category will not be displayed. This keeps items not being used or 'seasonal items' not being displayed out of season while still keeping them in the database. There is NO way to delete items already created unless you go into your sql database and do so manually. This was intended to be this way so that you can give them a category to display them or not on the items.php and inventory.php pages.

Maybe an area should be made to define how many items should be displayed on the items.php or inventory.php pages that an administrator can set? It would just have to be a small number box where you can put in "20" or "40" or whatever.

Items.php -
Side navigational bar code needs to be created to display what categories have been made so that a user can click on the category and have the items displayed to the opposite side. This keeps it nice and simple so that a user can choose to see ONLY the items of the category he selected to see, without having to file through random objects.

Pagenating and ordering needs to be set up on this page so that the 'number of items to be displayed on a page' allows less scrolling (see AP_Items for information) and the ordering of the items according to rank and alphabetical order. It should be 1-10, then alphabetically, descending.

Inventory.php -
This page needs the category code like items.php as well as pagenating and ordering, the other snippet code needed is the 'actions' area to the side is for the checkboxed 'actions' created with the specific categories in AP_Items. That way if a category has 'additional actions' checked they show up as a box to be used in the inventory.

Maybe they will have messages saying,
Eat = You have eatten item_name.
Use = You have used item_name.
Mix = You have mixed item_name.
Forge = You have forged item_name.
Open = You have opened item_name.
Drink You have dragon item_name.
______________________________________________________________________________________________

That is all for now. It is the base shop for an RPG mod someone might want to make some time. I know that my brother is making a java based rpg mod that allows you to 'synth items' by combining one or more items to make another and a duel based mod. I might post them up when they get done if it is something someone is interested in after this is finished.

If anyone has any ideas or wants to help, feel free to drop me a line here in the forum, you can find me on the punbb channel as well, or email me at LunacticInferno@gmail.com.

Thanks to Smartys for the skeleton of the shop, thanks to mark also for helping out off and on.

Included is a link to the zip ( http://aoirojoukai.validayne.net/ItemShop.zip ) with the pages you can download to try out, you can also see it in action at http://75.100.14.27/Forum/Items.php for the item page and  http://75.100.14.27/Forum/Inventory.php for the inventory page.

Version 1.5 DOES work and has been tested. It only needs to be finished now.

After almost a full day we finally got things working appropriately. Smarty, Mark, and myself ended up throwing snippets of script here there and everywhere in functions.php and admin_options to overthrow this.. dumb tyrant of unholy er.... coding... demons..

^>>^

^<<^

Or something like that.

For anyone that has this problem in the future, my gods, I feel your pain. I am backing all the stuff up now so that in case someone needs the corrections that we had to do to fix my forum, it will be made available upon request or if someone needs them again we know that the codes created DO work appropriately.

Thankyou guys so much for a rather hard problem that kept being persistent. It all worked out though. Back to business! Rickard, thank you as well I tried the domain thing and I might look into it some other day, I couldn't manage to set up the ip to be DNS with the domain name. I know less than I thought I once remembered of how to set that up, lol. Its been SOOOO long though.

Arigatoo, have a nice sleep guys, this kitty is out!

~Luna

Does anyone even know how to fix this.

Why is it that no one ever changes the crud so that it can remain the same for people that operate the forum from their computer, instead of everyone having to mess their files up trying to fix it. To me it sort of sounds stupid for someone to not be able to properly work as an administrator on their own forum just because of a stupid bad referrer protocol or leaving it redirect their users into oblivion to the point that they get tired of the same reoccurring problem every day.

All I need is for the thing to stop redirecting the users to 'localhost', I ended up changing the stupid base url to the external link but no, as always, /I/ can no longer work on anything on the site or delete even my own posts and messages because of the referrer error that just wondrously continues to happen. Obviously now changing the 'cache' file option back to 'localhost' no longer even works, cause then it just stupidly refreshes the whole darn thing back to the external link every single time, it does not matter if you delete all the cache files or not. The problem is just simply un-ending.

This is so stupid. Now I cannot do anything on my own forum as an administrator, let alone log in unless I stupidly continue to manually change the dumb config option under the cache folder each and every time that I click any and all links to go anywhere or do any thing. All it does is change it back and screw it all up.

Ive been racking my brain trying to get around this problem and I am just stumped... Its been 7 hours now working on this one continuous problem. Maybe someone can just give me a code to allow two base url's to be added so that both myself and others from the external link can use the forum without getting the dumb referrer error or being threatened with being redirected aimlessly....

The sad problem is, that I was going to start working on the shop mod but since I cant even work on anything, theres no way that its letting me check out 'creating items' since it blocks my ability to do so with that god darn referrer error. So yeah, it won' t even allow so much as that.

I am going to bed, this whole thing is starting to become more than a little aggrivating.

I think so. But that still does not solve the problem for the outside users nor me for accessing the forum properly. I need it to stop redirecting them to the stupid localhost or a lan ip and go BACK to just redirecting them to the ip that they are to use to access the forum, while at the same time I have to be able to access things as well from my own computer to view, use, and change administrator options.

If there is a way for me to connect to the external ip address then I need to know how to set that up so that I can do so, then change the base url to the external link once both I, myself, and others can access it through that link.

Each time that any of them log in or do anything at all its redirecting them, if the code for 1.2.16 version of this forum has caused this change then that bites.. I don't know anyone else that has had this problem at all and I don't know how to fix it myself.

internal link i am using : http://localhost/Forum/index.php
external link that everyone else uses : http://75.100.12.215/Forum/index.php
LAN link in the house : http://192.168.0.4/Forum/index.php

If I use localhost it obviously works and I can set everything up fine through the admin options and whatnot.

If I type in the external link I get 404 Not Found
The requested URL '/Forum' was not found on this server.

If I type in the lan links I get the site the same way as with localhost.

Of course if i set the Base URL to the LAN link of 192.168.0.4 then no one outside of the house can access a darn thing.

No, I cannot view the forum through the same links as they unless we somehow can get my network connection to allow it. I do not know how to do this, and the only other thing that maybe I can do if we cannot get my computer to view it in that way is to get a domain name for it, and I need to know 100% for sure that entering the domain name for my forum will allow me and everyone to access it in the correct manner before I go off and waste money for no reason.

^@@^ rawr.... syrup anyone?

The forum is listed here: http://75.100.12.215/Forum/index.php

You guys can try it yourselves. For now, I am gonna quickly run off for 5 minutes to make some yummy strawberry-chocolate chip pancakes for supper!
^**^

I do not have any other computer in the house that can run or maintain this forum since I am hosting it here on my computer. I am not able to access it from another source outside of my house or work on it, that will not solve the problem whatsoever neither.

I do not have an external server computer or any such thing like that, this is only hosted from within my computer with the ports set up through the router so that people may access it, and the sql and apache database and sources are set up as well. It has been working fine until now.

Setting the base url to the other ip address will lock my ability to change, create, or work on the forum completely because it will give ME the bad referrer error since its from within my own computer.

I do not know how to set up the network settings so that /this/ computer may view the forum and work on it through the external ip link or even the lan link of the internal address. If I go to any of the pages with these various ip's alll that I get is a 404 error saying

404 Not Found
The requested URL '/Forum' was not found on this server.

The same goes with any or all other pages that I would try to view in that fashion.

Well I am using a full url of http://localhost/Forum like I have been for the past few months, not a broken or part of,  and there has been no problem whatsoever up until today. These users are scattered throughout various countries and are not local to the server whatsoever. This problem has only started as of 4 hours ago after Mark and I worked on the aforementioned files and I have posted exactly what was changed in them or added.

This still does not tell what has happened to suddenly start redirecting users to 'localhost' instead of the links that they all came from of the external address. My own brother even in the house using the internal url base for just being upstairs even redirects him like all the others, they have to manually go in and type in the address bar the link of the ip addresses and take out 'localhost' in order to get it to work.

This is a redirection problem that has suddenly happened out of the blue, this is not a problem that has occurred before between the migration of the forum of 1.2.15 version and 1.2.16.

I need to know what has to be changed or where to look for this problem. I am NOT a coder or a professional programmer that knows everything about this. At the most I can just get lucky enough to make one or two things. Looking through all of the codes and the things we have done, even Mark says that he does not know what happened or went wrong. If he does not know, then surely there is no way in heck that I know either of what to look for since I know less than him.

So I don't have any idea what is causing this or what suddenly made it happen, nor do I know how to fix it; which is why I am posting here. It is not that the version of 1.2.16 is causing it, it is also not the fact that the URL base is improper either, if that was the cause then it would have happened way back in november, not now at the end of january or it even would have happened when upgrading between the versions.

^@@^

http://punbb.org/forums/viewtopic.php?id=18076

Would this work in any way?

Well, I have been using .16 and just up till today it worked fine. Then suddenly 3 hours ago after Mark and I worked on the second navi bar it did not.

How can I fix this so that it works properly again.

Ok, I did not have a problem with this beforehand until today.

Mark and I were working on a second navigational bar and then encountered a weird error suddenly out of the blue.

Below are the steps we did.

______________________________________________________________________

1. We edited main.tpl to put:
<pun_navibar2> under <pun_status>.  (worked)

2. We edited header.php and put in:
// START SUBST - <pun_navlinks2>
$tpl_main = str_replace('<pun_navlinks2>','<div id="brdmenu" class="inbox">'."\n\t\t\t". generate_navlinks2()."\n\t\t".'</div>', $tpl_main);
// END SUBST - <pun_navlinks2>

underneath the <pun_status> indicator code. (worked)

3. We edited functions.php with:
//
// New navbar
//
function generate_navlinks2()
{
    global $pun_config, $lang_common, $pun_user;
   
    // Index and Userlist should always be displayed
    $links[] = '';

    // Are there any additional navlinks we should insert into the array before imploding it?
    if ($pun_config['o_additional_navlinks'] != '')
    {
        if (preg_match_all('#([0-9]+)\s*=\s*(.*?)\n#s', $pun_config['o_additional_navlinks']."\n", $extra_links))
        {
            // Insert any additional links into the $links array (at the correct index)
            for ($i = 0; $i < count($extra_links[1]); ++$i)
                array_splice($links, $extra_links[1][$i], 0, array('<li id="navextra'.($i + 1).'">'.$extra_links[2][$i]));
        }
    }
    return '<ul>'."\n\t\t\t\t".implode($lang_common['Link separator'].'</li>'."\n\t\t\t\t", $links).'</li>'."\n\t\t\t".'</ul>';
}

(worked)

So the navi bar did work when done and at the top bar only the 'manditory links' such as:


    * Index
    * User list
    * Search
    * Profile
    * Messages
    * Administration
    * Logout

Were on the first bar, and on the second was :

    * Shop
    * Bank
    * Lottery
    * Donate
    * Dictionary
    * IRC Chat

as it should be.

______________________________________________________________________

However, suddenly it started redirecting people to 'localhost' instead of my ip like it use to.

Now, I did have http://localhost/Forum as the 'Base URL' in Admin>Options from the very start for the past few months, and it never redirected people when they logged in and out to 'localhost', it redirected them back to the original ip link they came from for the links below:

   * Index
    * User list
    * Search
    * Profile
    * Messages
    * Administration
    * Logout
and also when they go to post a topic, post, and PM message  it redirects them as well. The links on the bottom navi bar are 'extra' and are set up with the IP address, which those work fine and do not redirect the users.

After trying to figure out what happened we are somewhat lost of how to fix this back to how it was.

If I change the Base URL in the Admin>options to the ip that the users normally go to then I am unable to do anything as administrator because then I get the BAD_REFFERER_HTTP error, while they can do stuff. If I leave it at 'localhost' for me then I can work on it but now the users are being suddenly redirected; which never happened before today.

I need help to figure out why this suddenly changed and how to fix it.

Would getting a domain name for the forum and entering THAT as the base url in Admin>options work for both myself and the users?

Or is there another way? Or can we get this working how it was?

~Luna

14

(63 replies, posted in PunBB 1.2 modifications, plugins and integrations)

Well theres a Shop mod now out but it has no item creation options at all..just some user profile changes, or those you can do to other users, but in the basis of what a shop really is, its sadly lacking. It's a good start though for a skeleton.

Mod:
http://www.punres.org/viewtopic.php?pid=22463#p22463

But as I posted there... unless people can put their heads together to sort out the two pages (the first to create items, and second to view an invintory) needed and the permission setting for AP_Shop.php it lacks any real suitability. I tried working on one, but the probability of me actually being able to code it all is not going to happen. I have asked around for some help but apparently no one wants to actually work on this feature or take the project on;clearly nearly everyone wants it done.

For now... I give up and am going to bed.

15

(4 replies, posted in PunBB 1.2 troubleshooting)

All issues were currently resolved. Feel free to delete this topic.

Thanks!
~Luna