<?php

/* This page displays a list of comics, 15 per page. */

require_once('include/admin.inc.php');

auth_redirect(); // Require logged in user to access this page.

adminhead('Users');
adminmenu();
?>
<h2>User Administration</h2>
<p>Make changes to accounts for contributers to the website.</p>

<?php

$users = $mtdb->getAll("SELECT id,name,email,nameplate FROM contributor");

?>

<table class="widefat">
	<thead>
	<tr>
	<th scope="col" style="text-align: center;">User #</th>
	<th scope="col">Username</th>
	<th scope="col">Nickname</th>
	<th scope="col">Email</th>
	<th scope="col"></th>
	</tr>
	</thead>

	<tbody id="the-list">
	<?php
	$alternate=false;
	foreach( $users as $s ) {
		$alternate=!$alternate;
		?>
		<tr id="comic-<?php echo $s->id; ?>" <?php if($alternate) echo 'class="alternate"'; ?>>
		 <th scope="row" style="text-align: center;"><?php echo $s->id; ?></th>
		 <td><?php echo $s->name; ?></td>
		 <td><?php echo $s->nameplate; ?></td>
		 <td><?php echo $s->email; ?></td>
		 <td style="text-align: center;"><a href="user-edit.php?edit=<?php echo $s->id; ?>">Edit</a></td>
		</tr>
		<?php
	}
	?>
	</tbody>
</table>


<form enctype="multipart/form-data" name="create-user" id="create-user" action="user-edit.php" method="post">
<input type="hidden" name="edit" value="NEW" />

<h2>Create New Contributor</h2>
<div class="narrow">
	<table class="editform" width="100% cellspacing="2" cellpadding="5">
	<tr>
	<th scope="row" width="33%">Username</th>
	<td width="66%"><input name="user_login" type="text" id="user_login" value="" /></th>
	</tr>
	</table>
	
	<p class="submit"><input type="submit" value="Create &raquo;" name="submit" /></p>
</div>
</form>

<?php
adminfooter();
?>
