Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
cse4707-secure-messaging/public/admin.php
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
73 lines (66 sloc)
2.64 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
defined('APP_DIR') or define('APP_DIR', __DIR__ . '/../app/'); | |
include_once(APP_DIR . 'model/User.php'); | |
include_once(APP_DIR . 'include/http.php'); | |
$data = User::authenticated(); | |
if (!$data || $data->access != 'admin') { | |
Http::redirect('index.php'); | |
} | |
$users = User::all(); | |
include 'template/header.html'; | |
include 'template/user_menu_button.php'; | |
?> | |
<div class="row admin-container"> | |
<div class="col l8 m10 s12 offset-l2 offset-m1"> | |
<div class="row"> | |
<div class="col s12"> | |
<h1> Users </h1> | |
</div> | |
</div> | |
<?php foreach ($users as $user) { ?> | |
<div class="row card-panel scale-transition scale-out user-tile"> | |
<div class="col s3 blue-text valign-wrapper"> | |
<i class="small material-icons">perm_identity</i> | |
<span class="valign username"> <?php echo $user->username ?> </span> | |
</div> | |
<div class="col s5 red-text valign-wrapper"> | |
<i class="small material-icons">verified_user</i> | |
<span class="valign access_level">Access level: <?php echo $user->access ?> </span> | |
</div> | |
<div class="col s2"> | |
<a | |
class="modal-trigger btn tooltipped waves-effect waves-light" | |
data-position="bottom" data-delay="50" data-tooltip="Edit" | |
href="#edit-modal-<?php echo $user->id ?>" | |
> | |
<i class="small material-icons">mode_edit</i> | |
</a> | |
</div> | |
<div class="col s2"> | |
<form action="delete.php" method="post"> | |
<button | |
type="submit" class="btn tooltipped waves-effect waves-light" | |
data-position="bottom" data-delay="50" data-tooltip="Delete" | |
onclick="Materialize.toast('User deleted', 4000)" | |
> | |
<i class="small material-icons">delete</i> | |
<input name="username" value="<?php echo $user->username ?>" /> | |
</button> | |
</form> | |
</div> | |
</div> | |
<?php } ?> | |
</div> | |
</div> | |
<div class="fixed-action-btn"> | |
<a class="modal-trigger btn-floating btn-large red" href="#create-modal"> | |
<i class="large material-icons waves-effect waves-light">add</i> | |
</a> | |
</div> | |
<?php | |
foreach ($users as $user) { | |
include(APP_DIR . 'forms/edit.php'); | |
} | |
include(APP_DIR . 'forms/create.php'); | |
include 'template/footer.html'; | |
?> |