Location: PHPKode > projects > JobAppr > Jobappr-1.4/admin/users.php
<?php 
session_start();
if(!isset($_SESSION['password'])){
	header("Location: index.php");
	exit();
}
if( $_SESSION['role'] != 1 ){
	header("Location: dashboard.php");
	exit();
}
require_once('../includes/functions.php');
require_once('inc/admin-functions.php');

# VARIABLES
$user_id = $_SESSION['user_id'];
$alt=null;


if(isset($_GET['delete'])) {
	$status= mysql_query("DELETE FROM ". TB_USERS ." WHERE `username`='".$_GET['delete']."'");
	if($status) {
		$success = '<b>'.$_GET['delete'].'</b> has successfully deleted';
	} else {
		$error .= mysql_error();
	}
}

# get all user data
$data=mysql_query("SELECT * FROM ". TB_USERS ." ORDER BY username ASC");
?>

<?php get_template('header', 'Your Account'); ?>

	<div id="main">
		<?php display_messages(); ?>
		
		<h1>List of Users</h1>
		
		<table class="datalist" >
			<tr><th>Username</th><th>Name</th><th>Email</th><th>Registered</th><th class="nothing"></th></tr>
		<?php 
			while($user = mysql_fetch_assoc($data)) {
				echo '<tr '.$alt.'><td><a href="./edit_profile.php?id='.$user['user_id'].'">'.$user['username'].'</a></td><td>'.$user['first_name'].' '.$user['last_name'].'</td><td><a href="mailto:'.$user['email'].'">'.$user['email'].'</a></td><td>'.date("F j, Y", convert_datetime($user['registered'])).'</td><td class="nothing"><a href="'. get_filename().'?delete='.$user['username'].'" title="You are about to delete '.$user['username'].'" rel="'.$user['username'].'" rel2="users" class="delconfirm"><img src="assets/images/trash.gif" alt="Delete User" /></a></td></tr>' ."\n";
				if ($alt == '') {
					$alt = 'class="alternate"';
				} else {
					$alt = '';	
				}
			}
		
		?>
		</table>
		
	</div>
	
	

<?php get_template('sidebar'); ?>

<?php get_template('footer'); ?>
Return current item: JobAppr