<?phpdefine('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']);else if ($pun_config['o_shop_enabled'] == '0') message($lang_cash['Closed']);$page_title = pun_htmlspecialchars($pun_config['o_board_title'].' - Shop');define('PUN_ALLOW_INDEX', 1);require PUN_ROOT.'header.php';$action = isset($_GET['action']) ? $_GET['action'] : 'main';$userid = isset($_REQUEST['userid']) ? intval($_REQUEST['userid']) : 0;?><div class="block"> <div class="box"> <div class="inbox"><p><strong>If you are looking to buy items such as food, drink, misc items, then please go to the <a href="items.php">Items shop</a> which will sell these to you. This section is for user account changes.</strong></p> </div> </div></div><?phpswitch($action){ case 'do_donate': if($pun_config['o_shop_donate'] == '1') { $amount = abs(intval($_POST['amount'])); if($pun_user['cm_cash'] < $amount) message("Sorry, you don't have enough cash."); $query = $db->query('SELECT id, username FROM '.$db->prefix.'users WHERE username=\''.pun_htmlspecialchars($_POST['username']).'\' LIMIT 1'); if (!$db->num_rows($query)) message($lang_cash['User_not_exist']); $user = $db->fetch_assoc($query); $db->query('UPDATE '.$db->prefix.'users SET cm_cash=cm_cash+'.$amount.' WHERE id='.$user['id'].' LIMIT 1') or error('Unable to update + donate'); $db->query('UPDATE '.$db->prefix.'users SET cm_cash=cm_cash-'.$amount.' WHERE id='.$pun_user['id'].' LIMIT 1')or error('Unable to update - donate'); message("".$amount." ".$pun_config['cm_cur_name']." has been transferred to ".$user['username']); } break; case 'do_buy_title': if($pun_config['o_shop_title'] == '1') { $title = $db->escape($_POST['new_title']); if($pun_user['cm_cash'] < $pun_config['o_shop_titleprice']) message("Sorry, you don't have enough cash."); $db->query("UPDATE ".$db->prefix."users SET title = '".$title."', cm_cash = cm_cash - '".$pun_config['o_shop_titleprice']."' WHERE id = ".$pun_user['id']) or error('Unable to update user information', __FILE__, __LINE__, $db->error()); message("Your user title has been changed"); } break; case 'do_buy_title2': if($pun_config['o_shop_othertitle'] == '1') { $title = $db->escape($_POST['new_title']); if($pun_user['cm_cash'] < $pun_config['o_shop_otitleprice']) message("Sorry, you don't have enough cash."); $query = $db->query('SELECT id, username FROM '.$db->prefix.'users WHERE username=\''.pun_htmlspecialchars($_POST['username']).'\' LIMIT 1'); if (!$db->num_rows($query)) message($lang_cash['User_not_exist']); $user = $db->fetch_assoc($query); $db->query("UPDATE ".$db->prefix."users SET cm_cash = cm_cash - '".$pun_config['o_shop_otitleprice']."' WHERE id = ".$pun_user['id']) or error('Unable to update user information', __FILE__, __LINE__, $db->error()); $db->query("UPDATE ".$db->prefix."users SET title = '".$title."' WHERE id=".$user['id']) or error('Unable to update user information', __FILE__, __LINE__, $db->error()); message("The title of the user you selected has been changed."); } break; case 'do_buy_postcount': if($pun_config['o_shop_postcount15'] == '1') { $title = $db->escape($_POST['submit']); if($pun_user['cm_cash'] < $pun_config['o_shop_postprice']) message("Sorry, you don't have enough cash."); $db->query("UPDATE ".$db->prefix."users SET cm_cash = cm_cash - '".$pun_config['o_shop_postprice']."' WHERE id = ".$pun_user['id']) or error('Unable to update user infomation', __FILE__, __LINE__, $db->error()); $db->query("UPDATE ".$db->prefix."users SET num_posts = num_posts + '".$pun_config['o_shop_postcount']."' WHERE id =".$pun_user['id']) or error('Unable to update user information', __FILE__, __LINE__, $db->error()); message("Your post count had been changed."); } break; case 'do_buy_group': if($pun_config['o_shop_group'] == '1') { $title = $db->escape($_POST['submit']); if($pun_user['cm_cash'] < $pun_config['o_shop_groupprice']) message("Sorry, you don't have enough cash."); $db->query("UPDATE ".$db->prefix."users SET cm_cash = cm_cash - '".$pun_config['o_shop_groupprice']."' WHERE id = ".$pun_user['id']) or error('Unable to update user information....', __FILE__, __LINE__, $db->error()); $db->query("UPDATE ".$db->prefix."users SET group_id = '".$pun_config['o_shop_groupid']."' WHERE id = ".$pun_user['id']) or error('Unable to update user information', __FILE__, __LINE__, $db->error()); $result = $db->query("SELECT g_title FROM ".$db->prefix."groups WHERE g_id = ".$pun_config['o_shop_groupid']) or error('Unable to fetch group information', __FILE__, __LINE__, $db->error()); message("Your user group has been changed to ".$title = $db->result($result, 0)."."); } break; case 'do_buy_osig': if($pun_config['o_shop_osig'] == '1') { $title = $db->escape($_POST['new_osig']); if($pun_user['cm_cash'] < $pun_config['o_shop_osigprice']) message("Sorry, you don't have enough cash."); $query = $db->query('SELECT id, username FROM '.$db->prefix.'users WHERE username=\''.pun_htmlspecialchars($_POST['username']).'\' LIMIT 1'); if (!$db->num_rows($query)) message($lang_cash['User_not_exist']); $user = $db->fetch_assoc($query); $db->query("UPDATE ".$db->prefix."users SET cm_cash = cm_cash - '".$pun_config['o_shop_osigprice']."' WHERE id = ".$pun_user['id']) or error('Unable to update user information', __FILE__, __LINE__, $db->error()); $db->query("UPDATE ".$db->prefix."users SET signature = '".$title."' WHERE id = ".$user['id']) or error('Unable to update user information', __FILE__, __LINE__, $db->error()); message("The title of the user you selected has been changed."); } break; case 'do_buy_ball': if($pun_config['o_shop_ball'] == '1' && $pun_user['ball'] == '0') { $title = $db->escape($_POST['submit']); if($pun_user['cm_cash'] < $pun_config['o_shop_ballprice']) message("Sorry, you don't have enough cash."); $db->query("UPDATE ".$db->prefix."users SET cm_cash = cm_cash - '".$pun_config['o_shop_ballprice']."' WHERE id = ".$pun_user['id']) or error('Unable to update user information....', __FILE__, __LINE__, $db->error()); $db->query("UPDATE ".$db->prefix."users SET ball = 1 WHERE id = ".$pun_user['id']) or error('Unable to update ball...', __FILE__, __LINE__, $db->error()); message('You have bought a ball, You can select what you would like to do with this in your <a href="profile.php?section=items&id='.$pun_user['id'].'">Profile</a>'); } break; case 'do_buy_cookie': if ($pun_config['o_shop_cookie'] == '1' && $pun_user['cookie'] == '0') { $title = $db->escape($_POST['submit']); if($pun_user['cm_cash'] < $pun_config['o_shop_ballprice']) message("Sorry, you don't have enough cash."); $db->query("UPDATE ".$db->prefix."users SET cm_cash = cm_cash - '".$pun_config['o_shop_cookieprice']."' WHERE id = ".$pun_user['id']) or error('Unable to take payment for cookies', __FILE__, __LINE__, $db->error()); $db->query("UPDATE ".$db->prefix."users SET cookie = 1 WHERE id = ".$pun_user['id']) or error('Unable to give the cookie', __FILE__, __LINE__, $db->error()); message('You have bought a cookie, You can select what you would like to do with this in your <a href="profile.php?section=items&id='.$pun_user['id'].'">Profile</a>'); } break; case 'do_buy_drink': if ($pun_config['o_shop_drink'] == '1' && $pun_user['drink'] == '0') { $title = $db->escape($_POST['submit']); if($pun_user['cm_cash'] < $db->config['o_shop_drinkprice']) message("Sorry, you don't have enough cash."); $db->query("UPDATE ".$db->prefix."users SET cm_cash = cm_cash - '".$pun_config['o_shop_drinkprice']."' WHERE id = ".$pun_user['id']) or error('Unable to take payment for drink', __FILE__, __LINE__, $db->error()); $db->query("UPDATE ".$db->prefix."users SET drink = 1 WHERE id = ".$pun_user['id']) or error('Unable to give the drink', __FILE__, __LINE__, $db->error()); message('You have bought a drink, You can select what you would like to do with this in your <a href="profile.php?section=items&id='.$pun_user['id'].'">Prfile</a>'); } break; case 'main': default: if($pun_config['o_shop_donate'] == '1') { ?> <div id="bank" class="blockform"> <h2 class="block2"><span>Donate</span></h2> <div class="box"> <form name="userid" id="bank" method="post" action="shop.php?action=do_donate"> <div class="inform"> <fieldset> <legend><?php echo $lang_cash['Select_user_amount']; ?></legend> <div class="infldset"> <label><?php echo $lang_common['Username'] ?>:</label> <input type="input" name="username" value="<?php $user['username'] ?>" tabindex="1" /> <br /> <label>Amount:<br /> <input type="text" name="amount" tabindex="2" /> <?php echo $pun_config['cm_cur_name'] ?></label><br /> <input type="submit" name="submit" value="<?php echo $lang_common['Donate']; ?>" tabindex="3" /> </div> </fieldset> </div> </form> </div> </div> <?php } if($pun_config['o_shop_title'] == '1') { ?> <div id="bank" class="blockform"> <h2 class="block2"><span>Buy a new title</span></h2> <div class="box"> <form id="bank" method="post" action="shop.php?action=do_buy_title"> <div class="inform"> <fieldset> <legend>Enter a new title</legend> <div class="infldset"> <?php echo ucwords($pun_config['cm_cur_name']).': '.number_format($pun_user['cm_cash'])."<br />\n"; echo 'Cost: '.$pun_config['o_shop_titleprice'].' '.ucwords($pun_config['cm_cur_name'])."<br />\n"; ?> <label>New title:<br /> <input type="text" name="new_title" tabindex="4" /></label><br /> <input type="submit" name="submit" value="Buy" tabindex="5" /> </div> </fieldset> </div> </form> </div> </div> <?php } if($pun_config['o_shop_othertitle'] == '1') { ?> <div id="bank" class="blockform"> <h2 class="block2"><span>Buy another user a new title</span></h2> <div class="box"> <form id="bank" method="post" action="shop.php?action=do_buy_title2"> <div class="inform"> <fieldset> <legend>Enter a new title</legend> <div class="infldset"> <?php echo ucwords($pun_config['cm_cur_name']).': '.number_format($pun_user['cm_cash'])."<br />\n"; echo 'Cost: '.$pun_config['o_shop_otitleprice'].' '.ucwords($pun_config['cm_cur_name'])."<br />\n"; ?> <label>Who's title to change:<br /> <input type="input" name="username" value="<?php $user['username'] ?>" tabindex="6" /></label><br /> <label>New title:<br /> <input type="text" name="new_title" tabindex="7" /></label><br /> <input type="submit" name="submit" value="Buy" tabindex="8" /> </div> </fieldset> </div> </form> </div> </div> <?php } if($pun_config['o_shop_postcount15'] == '1') { ?> <div id="bank" class="blockform"> <h2 class="block2"><span>Increase post count by <?php echo $pun_config['o_shop_postcount']; ?></span></h2> <div class="box"> <form id="bank" method="post" action="shop.php?action=do_buy_postcount"> <div class="inform"> <fieldset> <legend>Increase Post count</legend> <div class="infldset"> <?php echo ucwords($pun_config['cm_cur_name']).': '.number_format($pun_user['cm_cash'])."<br />\n"; echo 'Cost: '.$pun_config['o_shop_postprice'].' '.ucwords($pun_config['cm_cur_name'])."<br />\n"; ?> <label>Increase post count by <?php echo $pun_config['o_shop_postcount']; ?><br /> <input type="submit" name="submit" value="Buy" tabindex="9" /> </div> </fieldset> </div> </form> </div> </div> <?php } if($pun_config['o_shop_group'] == '1') { $result = $db->query("SELECT g_title FROM ".$db->prefix."groups WHERE g_id = ".$pun_config['o_shop_groupid']) or error('Unable to fetch group information', __FILE__, __LINE__, $db->error()); ?> <div id="bank" class="blockform"> <h2 class="block2"><span>Change to <?php echo $title = $db->result($result, 0); ?> user group</span></h2> <div class="box"> <form id="bank" method="post" action="shop.php?action=do_buy_group"> <div class="inform"> <fieldset> <legend>Change to <?php echo $title = $db->result($result, 0); ?></legend> <div class="infldset"> <?php echo ucwords($pun_config['cm_cur_name']).': '.number_format($pun_user['cm_cash'])."<br />\n"; echo 'Cost: '.$pun_config['o_shop_groupprice'].' '.ucwords($pun_config['cm_cur_name'])."<br />\n"; ?> <label>Change to <?php echo $title = $db->result($result, 0); ?><br /> <input type="submit" name="submit" value="Buy" tabindex="10" /> </div> </fieldset> </div> </form> </div> </div> <?php } if($pun_config['o_shop_osig'] == '1') { ?> <div id="bank" class="blockform"> <h2 class="block2"><span>Buy another user a signature</span></h2> <div class="box"> <form id="bank" method="post" action="shop.php?action=do_buy_osig"> <div class="inform"> <fieldset> <legend>Enter a new signature</legend> <div class="infldset"> <?php echo ucwords($pun_config['cm_cur_name']).': '.number_format($pun_user['cm_cash'])."<br />\n"; echo 'Cost: '.$pun_config['o_shop_osigprice'].' '.ucwords($pun_config['cm_cur_name'])."<br />\n"; ?> <label>Who's signature to change:<br /> <input type="input" name="username" value="<?php $user['username'] ?>" tabindex="11" /></label><br /> <label>New signature:<br /> <textarea tabindex="12" name="new_osig" id="taMessage2" cols="50" rows="5" onfocus="this.value = (this.value=='Your signature was a little boring, So I thought I would spice it up a little for you!')? '' : this.value;"onkeyup="CheckFieldLength(taMessage2, 'charcount2', 'remaining2', 400);" onkeydown="CheckFieldLength(taMessage2, 'charcount2', 'remaining2', 400);" onmouseout="CheckFieldLength(taMessage2, 'charcount2', 'remaining2', 400);">Your signature was a little boring, So I thought I would spice it up a little for you!</textarea><br> </label><br /> <input type="submit" name="submit" value="Buy" tabindex="13" /> </div> </fieldset> </div> </form> </div> </div> <?php } break;}require PUN_ROOT.'footer.php';?>