rendered paste body<?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']);
$page_title = pun_htmlspecialchars($pun_config['o_board_title'].' - '.$lang_common['Shop']);
define('PUN_ALLOW_INDEX', 1);
require PUN_ROOT.'header.php';
if (isset($_POST['submit'])) {
$amount = intval($_POST['amount']);
$query = $db->query('SELECT id, username FROM '.$db->prefix.'users WHERE username=\''.pun_htmlspecialchars($_POST['username']).'\' LIMIT 1');
$user = $db->fetch_assoc($query);
if ($pun_user['cm_cash'] < $amount || $amount < 0)
message($lang_cash['Not_enough'].' '.$pun_config['cm_cur_name'].'.');
$db->query('UPDATE '.$db->prefix.'users SET cm_cash=cm_cash+'.$amount.' WHERE id='.$user['id'].' LIMIT 1');
$db->query('UPDATE '.$db->prefix.'users SET cm_cash=cm_cash-'.$amount.' WHERE id='.$pun_user['id'].' LIMIT 1');
echo ' <div id="bank" class="blockform">
<h2 class="block2"><span>'.$lang_common['Donate'].'</span></h2>
<div class="box">
<form id="bank" method="post" action="shop.php">
<div class="inform">
<fieldset>
<legend>'.$lang_cash['Donations'].'</legend>
<div class="infldset">
<div>'.$lang_cash['Donation_sent_to'].' '.$user['username'].' '.$lang_cash['with_amount_of'].' '.number_format($amount).' '.$pun_config['cm_cur_name'].'.</div>
<div><a href="shop.php">'.$lang_common['Go back'].'</a>.</div>
</div>
</fieldset>
</div>
</form>
</div>
</div>';
} else {
if (isset($_GET['userid'])) {
$userid = intval($_GET['userid']);
$query = $db->query('SELECT id, username FROM '.$db->prefix.'users WHERE id='.$userid.' LIMIT 1');
if (!$db->num_rows($query))
$userid = 0;
else
$user = $db->fetch_assoc($query);
} else
$userid = 0;
echo ' <div id="bank" class="blockform">
<h2 class="block2"><span>Donate</span></h2>
<div class="box">
<form id="bank" method="post" action="shop.php">
<div class="inform">
<fieldset>
<legend>'.$lang_cash['Select_user_amount'].'</legend>
<div class="infldset">';
if ($userid == 0) {
echo ' <div>'.$lang_common['Username'].': <input type="input" name="username" value="" tabindex="2" /></div>';
} else {
echo ' <div>'.$lang_common['Username'].': <input type="input" name="username" value="'.$user['username'].'" tabindex="2" /></div>';
}
echo ' <div>'.$lang_cash['Amount'].': <input type="input" name="amount" value="0" tabindex="2" /></div>
<div><br /><input type="submit" name="submit" value="'.$lang_common['Donate'].'" tabindex="2" /></div>
</div>
</fieldset>
</div>
</form>
</div>
</div>';
// ===================================================================================
//================= BUY A NEW TITLE ==================================
//====================================================================================
if (isset($_POST['submit2'])) {
$title = intval($_POST['title']);
$query = $db->query('SELECT id, title, cm_cash FROM '.$db->prefix.'users WHERE title=\''.pun_htmlspecialchars($_POST['title']).'\' LIMIT 1');
$user = $db->fetch_assoc($query);
if ($pun_user['cm_cash'] < 1000)
message($lang_cash['Not_enough'].' '.$pun_config['cm_cur_name'].'.');
$db->query('UPDATE '.$db->prefix.'users SET title = \''.$db->escape($_POST['title']).'\' WHERE id='.$pun_user['id'].' LIMIT 1');
$db->query('UPDATE '.$db->prefix.'users SET cm_cash=cm_cash-1000 WHERE id='.$pun_user['id'].' LIMIT 1');
echo ' <div id="bank" class="blockform">
<h2 class="block2"><span>Buy A New Title</span></h2>
<div class="box">
<form id="title" method="post" action="shop.php">
<div class="inform">
<fieldset>
<legend>Bought a new title</legend>
<div class="infldset">
<div>You have successfully changed your usertitle.</div>
<div><a href="shop.php">'.$lang_common['Go back'].'</a>.</div>
</div>
</fieldset>
</div>
</form>
</div>
</div>';
} else {
if (isset($_GET['title'])) {
$userid = intval($_GET['title']);
$query = $db->query('SELECT id, username, title FROM '.$db->prefix.'users WHERE id='.$userid.' LIMIT 1');
if (!$db->num_rows($query))
$userid = 0;
else
$user = $db->fetch_assoc($query);
} else
$userid = 0;
echo ' <div id="title" class="blockform">
<h2 class="block2"><span>Buy A New Title</span></h2>
<div class="box">
<form id="title" method="post" action="shop.php">
<div class="inform">
<fieldset>
<legend>Enter A New Title</legend>
<div class="infldset">';
echo ucwords($pun_config['cm_cur_name']).': '.number_format($pun_user['cm_cash']);
echo '<br /><lable>Cost: 1000 Dolars</label>';
if ($userid == 0) {
echo ' <div>New Title: <input type="text" name="title" value="'.pun_htmlspecialchars($user['title']).'" size="30" maxlength="50" /></div>';
} else {
echo ' <div>New Title: <input type="text" name="title" value="'.pun_htmlspecialchars($user['title']).'" size="30" maxlength="50" /></div>';
}
echo '
<div><br /><input type="submit" name="submit2" value="Buy" tabindex="2" /></div>
</div>
</fieldset>
</div>
</form>
</div>
</div>';
// ===================================================================================
//================= BUY A NEW TITLE FOR SOMEONE ELSE ====================
//====================================================================================
if (isset($_POST['submit3'])) {
$title = intval($_POST['title2']);
$query = $db->query('SELECT id, title, cm_cash FROM '.$db->prefix.'users WHERE title=\''.pun_htmlspecialchars($_POST['title2']).'\' LIMIT 1');
$user = $db->fetch_assoc($query);
if ($pun_user['cm_cash'] < 1000)
message($lang_cash['Not_enough'].' '.$pun_config['cm_cur_name'].'.');
$query = $db->query('SELECT username, id, title FROM '.db-prefix.'users WHERE username = \''.$db->escape($_POST['whos']).'\' LIMIT 1');
$db->query('UPDATE '.$db->prefix.'users SET title = \''.$db->escape($_POST['title2']).'\' WHERE username =\''.$db->escape($_POST['whos']).'\' LIMIT 1');
$db->query('UPDATE '.$db->prefix.'users SET cm_cash=cm_cash-1 WHERE id ='.$pun_user['id'].' LIMIT 1');
echo ' <div id="bank" class="blockform">
<h2 class="block3"><span>Buy A New Title For Someone Else</span></h2>
<div class="box">
<form id="title" method="post" action="shop.php">
<div class="inform">
<fieldset>
<legend>Bought a new title for someone else!</legend>
<div class="infldset">
<div>You have successfully changed someones usertitle.</div>
<div><a href="shop.php">'.$lang_common['Go back'].'</a>.</div>
</div>
</fieldset>
</div>
</form>
</div>
</div>';
} else {
if (isset($_GET['title2'])) {
$userid = intval($_GET['title2']);
$query = $db->query('SELECT id, username, title FROM '.$db->prefix.'users WHERE id='.$userid.' LIMIT 1');
if (!$db->num_rows($query))
$userid = 0;
else
$user = $db->fetch_assoc($query);
} else
$userid = 0;
echo ' <div id="title" class="blockform">
<h2 class="block3"><span>Buy A New Title For Someone Else</span></h2>
<div class="box">
<form id="title" method="post" action="shop.php">
<div class="inform">
<fieldset>
<legend>Enter A New Title</legend>
<div class="infldset">';
echo ucwords($pun_config['cm_cur_name']).': '.number_format($pun_user['cm_cash']);
echo '<br /><lable>Cost: 1000 Dolars</label>';
if ($userid == 0) {
echo ' <div>Whos Title To Change: <input type="input" name="whos" value="" tabindex="2" /></div>';
} else {
echo ' <div>Whos Title To Change: <input type="input" name="whos" value="'.pun_htmlspecialchars($user['username']).'" tabindex="2" /></div>';
}
echo ' <div>Change To: <input type="input" name="title2" value="'.pun_htmlspecialchars($user['title']).'" tabindex="2" /></div>
<div><br /><input type="submit" name="submit3" value="Buy" tabindex="2" /></div>
</div>
</fieldset>
</div>
</form>
</div>
</div>';
}
}
}
require PUN_ROOT.'footer.php';