All pastes #471442 Raw Edit

Stuff

public php v1 · immutable
·published 2007-05-04 22:06 UTC
rendered paste body
<?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']);$page_title = pun_htmlspecialchars($pun_config['o_board_title'].' - '.$lang_common['Shop']);define('PUN_ALLOW_INDEX', 1);require PUN_ROOT.'header.php';$action = isset($_GET['action']) ? $_GET['action'] : 'main';$userid = isset($_POST['userid']) ? intval($_POST['userid']) : 0;switch($action){	case 'do_donate':		$amount = abs(intval($_POST['amount']));		if($pun_user['cm_cash'] < $amount)			message("Sorry, you don't have enough cash.");				$db->query("UPDATE ".$db->prefix."users SET cm_cash = cm_cash - ".$amount." WHERE id = ".$pun_user['id']) or error('Unable to update user information', __FILE__, __LINE__, $db->error());		$db->query("UPDATE ".$db->prefix."users SET cm_cash = cm_cash + ".$amount." WHERE id = ".$userid) or error('Unable to update user information', __FILE__, __LINE__, $db->error());				message("The cash has been transferred to the selected user.");	break;		case 'do_buy_title':		$title = $db->escape($_POST['new_title']);				if($pun_user['cm_cash'] < 1000)			message("Sorry, you don't have enough cash.");				$db->query("UPDATE ".$db->prefix."users SET title = '".$title."', cm_cash = cm_cash - 1000 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':		$title = $db->escape($_POST['new_title']);				if($pun_user['cm_cash'] < 10000)			message("Sorry, you don't have enough cash.");				$db->query("UPDATE ".$db->prefix."users SET cm_cash = cm_cash - 10000 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 = ".$userid) or error('Unable to update user information', __FILE__, __LINE__, $db->error());				message("The title of the user you selected has been changed.");	break;		case 'main':	default:		?>		<div id="bank" class="blockform">			<h2 class="block2"><span>Donate</span></h2>			<div class="box">				<form 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']; ?>:<br />								<select name="userid">									<?php									$result = $db->query("SELECT id, username FROM ".$db->prefix."users WHERE group_id != ".PUN_UNVERIFIED." AND group_id != ".PUN_GUEST) or error('Unable to fetch user information', __FILE__, __LINE__, $db->error());;									while($row = mysql_fetch_assoc($result))										echo '<option value="'.$row['id'].'">'.$row['username']."</option>\n";									?>								</select></label><br />								<label>Amount:<br />									<input type="text" name="amount" /></label><br />								<input type="submit" name="submit" value="<?php echo $lang_common['Donate']; ?>" />							</div>						</fieldset>					</div>				</form>			</div>		</div>				<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: 1000 '.ucwords($pun_config['cm_cur_name'])."<br />\n";								?>								<label>New title:<br />									<input type="text" name="new_title" /></label><br />								<input type="submit" name="submit" value="Buy" />							</div>						</fieldset>					</div>				</form>			</div>		</div>				<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: 10000 '.ucwords($pun_config['cm_cur_name'])."<br />\n";								?>								<label>Who's title to change:<br />								<select name="userid">									<?php									$result = $db->query("SELECT id, username FROM ".$db->prefix."users WHERE group_id != ".PUN_UNVERIFIED." AND group_id != ".PUN_GUEST." AND id != ".$pun_user['id']) or error('Unable to fetch user information', __FILE__, __LINE__, $db->error());									while($row = mysql_fetch_assoc($result))										echo '<option value="'.$row['id'].'">'.$row['username']."</option>\n";									?>								</select></label><br />								<label>New title:<br />									<input type="text" name="new_title" /></label><br />								<input type="submit" name="submit" value="Buy" />							</div>						</fieldset>					</div>				</form>			</div>		</div>		<?php	break;}require PUN_ROOT.'footer.php';?>