All pastes #481084 Raw Edit

Something

public text v1 · immutable
·published 2007-05-10 16:39 UTC
rendered paste body
<?php
// Make sure no one attempts to run this script "directly"
if (!defined('PUN'))
	exit;

if (!function_exists('generate_config_cache')) // If the file include/cache.php wasn't already included, include it now
	require PUN_ROOT.'include/cache.php';

// Tell admin_loader.php that this is indeed a plugin and that it is loaded
define('PUN_PLUGIN_LOADED', 1);
generate_admin_menu($plugin);
$now = time();
?>

	<div class="blockform">
		<h2><span>Cash Mod</span></h2>
		<div class="box">
			<form method="post" action="<?php echo $_SERVER['REQUEST_URI'] ?>">
				<p class="submittop"><input type="submit" name="submit" value="Save changes" /></p>
				<div class="inform">
					<fieldset>

						<legend>Donate</legend>
						<div class="infldset">
							<table class="aligntop" cellspacing="0">
								<tr>
									<th scope="row">Donate Enabled</th>
									<td>
										<input type="radio" name="donate_enabled" value="1"<?PHP if ($pun_config['o_shop_donate'] == 1) { echo ' checked="checked"'; } ?> />&nbsp;<strong>Yes</strong>&nbsp;&nbsp;&nbsp;<input type="radio" name="donate_enabled" value="0"<?PHP if ($pun_config['o_shop_donate'] == 0) { echo ' checked="checked"'; } ?> />&nbsp;<strong>No</strong>
										<span>If selected Yes, users will have the option of donating.</span>
									</td>
								</tr>
							</table>
						</div>
					</fieldset>
				</div>
				<div class="inform">
					<fieldset>

						<legend>Title Change</legend>
						<div class="infldset">
							<table class="aligntop" cellspacing="0">
								<tr>
									<th scope="row">Title Change Enabled</th>
									<td>
										<input type="radio" name="title" value="1"<?PHP if ($pun_config['o_shop_title'] == 1) { echo ' checked="checked"'; } ?> />&nbsp;<strong>Yes</strong>&nbsp;&nbsp;&nbsp;<input type="radio" name="title" value="0"<?PHP if ($pun_config['o_shop_title'] == 0) { echo ' checked="checked"'; } ?> />&nbsp;<strong>No</strong>
										<span>When set to Yes, users will have the option of changing there title.</span>
									</td>
								</tr>
							</table>
						</div>
					</fieldset>
				</div>
				<div class="inform">
					<fieldset>

						<legend>Other Persons Title</legend>
						<div class="infldset">
							<table class="aligntop" cellspacing="0">
								<tr>
									<th scope="row">Other Persons Title Enabled</th>
									<td>
										<input type="radio" name="other" value="1"<?PHP if ($pun_config['o_shop_othertitle'] == 1) { echo ' checked="checked"'; } ?> />&nbsp;<strong>Yes</strong>&nbsp;&nbsp;&nbsp;<input type="radio" name="other" value="0"<?PHP if ($pun_config['o_shop_othertitle'] == 0) { echo ' checked="checked"'; } ?> />&nbsp;<strong>No</strong>
										<span>When set to Yes, users will have the option of changing someone elses title.</span>
									</td>
								</tr>
							</table>
						</div>
					</fieldset>
				</div>
                <div class="inform">
                	<fieldset>
                    	
                        <legend>Post Count</legend>
                        <div class="infldset">
                        	<table class="aligntop" cellspacing="0">
                            	<tr>
                                	<th scope="row">Change Post Count</th>
                                    <td>
                                    	<input type="radio" name="postcount" value="1"<?PHP if ($pun_config['o_shop_postcount15'] == 1) { echo ' checked="checked"'; } ?> />&nbsp;<strong>Yes</strong>&nbsp;&nbsp;&nbsp;<input type="radio" name="postcount" value="0"<?PHP if ($pun_config['o_shop_postcount15'] == 0) { echo ' checked="check"' ; } ?> />&nbsp;<strong>No</strong>
                                        <span>When set to Yes, users will have the option of changing there post count.</span>
                                       </td>
								</tr>
							</table>
						</div>
                    </fieldset>
                 </div>
                <div class="inform">
                	<fieldset>
                    	
                        <legend>User Group</legend>
                        <div class="infldset">
                        	<table class="aligntop" cellspacing="0">
                            	<tr>
                                	<th scope="row">Change User Group</th>
                                    <td>
                                    	<input type="radio" name="usergroup" value="1"<?PHP if ($pun_config['o_shop_vip'] == 1) { echo ' checked="checked"'; } ?> />&nbsp;<strong>Yes</strong>&nbsp;&nbsp;&nbsp;<input type="radio" name="usergroup" value="0"<?PHP if ($pun_config['o_shop_vip'] == 0) { echo ' checked="check"' ; } ?> />&nbsp;<strong>No</strong>
                                        <span>When set to Yes, users will have the option of changing there user group.</span>
                                       </td>
								</tr>
							</table>
						</div>
                    </fieldset>
                 </div>
				<p class="submitend"><input type="submit" name="submit" value="Save changes" /></p>
			</form>
		</div>
	</div>

<?PHP

		$currency = pun_htmlspecialchars($_POST['cur_name']);
		$db->query('UPDATE '.$db->prefix.'users SET cm_bank=(cm_bank+cm_bank*((('.$now.'-cm_interest)/86400)*'.$pun_config['cm_interest'].'/100)), cm_interest='.$now.'') or error('Unable to update config', __FILE__, __LINE__, $db->error());

		$db->query('UPDATE '.$db->prefix.'config SET conf_value=\''.$currency.'\' WHERE conf_name=\'cm_cur_name\' LIMIT 1');
		$db->query('UPDATE '.$db->prefix.'config SET conf_value='.intval($_POST['bank_enabled']).' WHERE conf_name=\'cm_bank\' LIMIT 1') or error('Unable to update config', __FILE__, __LINE__, $db->error());
		$db->query('UPDATE '.$db->prefix.'config SET conf_value='.intval($_POST['lottery_enabled']).' WHERE conf_name=\'cm_lottery\' LIMIT 1') or error('Unable to update config', __FILE__, __LINE__, $db->error());
		$db->query('UPDATE '.$db->prefix.'config SET conf_value='.intval($_POST['intereste']).' WHERE conf_name=\'cm_intereste\' LIMIT 1') or error('Unable to update config', __FILE__, __LINE__, $db->error());
		$db->query('UPDATE '.$db->prefix.'config SET conf_value='.intval($_POST['interest']).' WHERE conf_name=\'cm_interest\' LIMIT 1') or error('Unable to update config', __FILE__, __LINE__, $db->error());
		$db->query('UPDATE '.$db->prefix.'config SET conf_value='.intval($_POST['last_win']).' WHERE conf_name=\'cm_last_win\' LIMIT 1') or error('Unable to update config', __FILE__, __LINE__, $db->error());
		$db->query('UPDATE '.$db->prefix.'config SET conf_value='.intval($_POST['lottery_cost']).' WHERE conf_name=\'cm_lottery_cost\' LIMIT 1') or error('Unable to update config', __FILE__, __LINE__, $db->error());
		$db->query('UPDATE '.$db->prefix.'config SET conf_value='.intval($_POST['lottery_pot']).' WHERE conf_name=\'cm_lottery_pot\' LIMIT 1') or error('Unable to update config', __FILE__, __LINE__, $db->error());
		$db->query('UPDATE '.$db->prefix.'config SET conf_value='.intval($_POST['lottery_chance']).' WHERE conf_name=\'cm_lottery_chance\' LIMIT 1') or error('Unable to update config', __FILE__, __LINE__, $db->error());
		generate_config_cache();

	
	
		$query = $db->query('SELECT * FROM '.$db->prefix.'forums ORDER BY disp_position');
		if (!$db->num_rows($query))
			message('There are currently not any forums.');
		while ($forum = $db->fetch_assoc($query)) {
			if (isset($_POST['cpt_'.$forum['id']])) {
				$db->query('UPDATE '.$db->prefix.'forums SET cm_cpt='.intval($_POST['cpt_'.$forum['id']]).' WHERE id='.$forum['id'].' LIMIT 1') or error('Unable to update forums', __FILE__, __LINE__, $db->error());
			}
			if (isset($_POST['cpp_'.$forum['id']])) {
				$db->query('UPDATE '.$db->prefix.'forums SET cm_cpp='.intval($_POST['cpp_'.$forum['id']]).' WHERE id='.$forum['id'].' LIMIT 1') or error('Unable to update forums', __FILE__, __LINE__, $db->error());
			}
		}
?>