Location: PHPKode > scripts > PHP Address book > php-address-book_v_1.02_eng/user_management.php
<?php 
include_once 'includes/header.inc.php';

if(!$session->getRole() == 2){
    header("location: login.php");
}

?>
<legend>User management</legend>
<table class="table table-striped">
    <tr>
        <th>Role</th>
        <th>Username</th>
        <th>E-mail</th>
        <th>Mailinglist</th>
    </tr>
    <?php
$query = $mysqli->prepare("SELECT 
                            `cal_users`.`role`,
                            `cal_users`.`username`,
                            `cal_users`.`email`,
                            `cal_users`.`mailinglist`,
                            `cal_users`.`id`,
                            `cal_roles`.`id`, 
                            `cal_roles`.`role`
                          FROM 
                            `cal_users` 
                          JOIN 
                            `cal_roles` 
                          ON 
                            `cal_users`.`role` = `cal_roles`.`id` 
                         ");
$query->bind_result($role, $username, $email, $mailinglist, $userid, $role_id, $role_name);
$query->execute();

while($query->fetch()){
    ?>
    <tr>
        <td><?php echo $role_name; ?></td>
        <td><a href="<?php echo $url; ?>user_edit.php?id=<?php echo $userid; ?>"><?php echo $username; ?></a></td>
        <td><?php echo $email; ?></td>
        <td><?php if($mailinglist == 1){ echo "<i class='icon-ok'></i>"; } else { echo "<i class='icon-remove'></i>"; } ?></td>
    </tr>
    <?php
}
$query->store_result();
?>
</table>
<a href="user_add.php" class="btn">Add new user</a>
<?php include_once 'includes/footer.inc.php'; ?>
Return current item: PHP Address book