Location: PHPKode > projects > WH Community > wh_community/admin/moderators.php
<?php include('files/header.php'); ?>
<div id="content-outer">
<div id="content">

	<div id="page-heading">
		<h1><?php echo $lang_admin['moderators']; ?></h1>
	</div>
	
	<table border="0" width="100%" cellpadding="0" cellspacing="0" id="content-table">
	<tr>
		<th rowspan="3" class="sized"><img src="files/shared/side_shadowleft.jpg" width="20" height="300" alt="shadow_l"></th>
		<th class="topleft"></th>
		<td id="tbl-border-top">&nbsp;</td>
		<th class="topright"></th>
		<th rowspan="3" class="sized"><img src="files/shared/side_shadowright.jpg" width="20" height="300" alt="shadow_r"></th>
	</tr>
	<tr>
		<td id="tbl-border-left"></td>
		<td><div id="content-table-inner">
			<div id="table-content">
			<p><?php
			
			if(isset($_POST['user_name'])){
			$_POST = get_magic_quotes_gpc() ? array_map( 'stripslashes', $_POST ) : $_POST;
			$user_name = $_POST['user_name'];
			
			$sql = "UPDATE
						users
					SET
						user_level = '2'
					WHERE
						user_name = '" . mysql_escape_string($user_name) . "'";
			
			mysql_query($sql);
			
			if(mysql_affected_rows() == 1) {
			echo '<p><u>' . $user_name . '</u> ' . $lang_admin['appointed_moderator'] . '</p>';
			
				}else{
				echo '<p>' . $lang_admin['not_appointed_mod'] . '</p>';
				}
			}
			
			?>
			<form action="?user_name" method="post" name="user_name">
			<input name="user_name" class="fields" type="text" size="40"> <input name="submit" class="button" type="submit" value="<?php echo $lang_admin['appoint_moderator']; ?>">
			</form></p><br />
			<p><strong><u><?php echo $lang_admin['entered_moderators']; ?> (<?php $bword = mysql_query("SELECT user_id FROM users WHERE user_level = '2'"); 
				  $allwords = mysql_num_rows($bword); 
				  echo $allwords; ?>)</u></strong></p>
			<p>&nbsp;</p>
			<p><?php
			
			$query = "SELECT * FROM users WHERE user_level = '2'"; 
			$result = mysql_query($query);
			
			if($result) {
			echo '<table width="100%" class="maintable">
			<tr>
			<td width="5%"><strong>ID</strong></td>
			<td width="85%"><strong>User Name</strong></td>
			<td width="10%"><span class="false">' . $lang_admin['delete'] . '</span></td>
			</tr>
			</table>';
			
			while($row = mysql_fetch_array($result, MYSQL_ASSOC)) {
			echo '<table width="100%" class="maintable">
			<tr>
			<td width="5%"><strong>' . htmlentities($row['user_id']) . '</strong></td>
			<td width="85%"><span class="blue">' . htmlentities($row['user_name']) . '</span></td>
			<td width="10%"><a href="moderators_remove.php?user_id=' . $row['user_id'] . '"><img src="files/delete.png" width="16" height="16" border="0" title="' . $lang_admin['delete'] . '"></a></td>
			</tr>';
			}
			
			echo '</table>';
			
				}else{
				echo '<p class="false">' . $lang_admin['no_records'] . '.</p>';
				}
			
			?></p>
			</div>
		</div></td>
		<td id="tbl-border-right"></td>
	</tr>
	<tr>
		<th class="sized bottomleft"></th>
		<td id="tbl-border-bottom">&nbsp;</td>
		<th class="sized bottomright"></th>
	</tr>
	</table>
			
	<div class="clear"></div>
		 
	</div>

	<div class="clear">&nbsp;</div>

</div>
<div class="clear">&nbsp;</div>
</div>
<?php include('files/footer.php'); ?>
Return current item: WH Community