| Server IP : 210.245.233.93 / Your IP : 216.73.216.226 Web Server : Apache/2.2.15 (CentOS) System : Linux webserver2.onesolution.com.hk 2.6.32-754.35.1.el6.x86_64 #1 SMP Sat Nov 7 12:42:14 UTC 2020 x86_64 User : apache ( 48) PHP Version : 5.3.3 Disable Function : exec, shell_exec, system, passthru, popen, proc_open, pcntl_exec MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /var/www/(Del)pathways.org.hk/MIS_bk/user/ |
Upload File : |
<?php
require_once(__DIR__ . '/../checkuser.php');
function index() {
global $dbh;
$message = $_GET['message'] ?: null;
$where = "user.deleted = ?";
$parameters = array(0);
switch ($_SESSION['webadmin']['role']) {
case 2: // Admin
$where .= " AND user.role <> ?";
$parameters[] = 1; // SuperAdmin
break;
case 3: // Staff
$where .= " AND user.id = ?";
$parameters[] = (int)$_SESSION['webadmin']['id'];
break;
}
$sql = "
SELECT user.*
FROM sys_login user
WHERE $where
ORDER BY user.role, user.username";
$sth = Db\Util::execute($dbh, $sql, $parameters);
$users = $sth->fetchAll();
return array(
'users' => $users,
'message' => $message,
'userRoleOptions' => User::roleOptions(),
);
}
extract(index());
?><!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<?php require(__DIR__ . '/../inc/_head_meta.php'); ?>
<?php require(__DIR__ . '/../inc/_head_css.php'); ?>
<?php require(__DIR__ . '/../inc/_head_script.php'); ?>
</head>
<body>
<?php require( __DIR__ . '/../inc/_navbar.php'); ?>
<div class="text-right">
<ul class="breadcrumb">
<li><a href="#">System</a> <span class="divider">></span></li>
<li class="active">User</li>
</ul>
</div>
<div class="container-fluid pathways-container">
<?php if (isset($message) && !empty($message)): ?>
<div class="alert alert-info">
<button type="button" class="close" data-dismiss="alert">×</button>
<h5 class="alert-heading">Note:</h5>
<p><?=$message?></p>
</div>
<?php endif; ?>
<a href="form.php" class="btn pull-right"><i class="icon-plus"></i> Add</a>
<h3>User</h3>
<?php if (empty($users)): ?>
<p>There are no records.</p>
<?php else: ?>
<form id="form" action="" method="post">
<table class="table table-striped table-bordered table-hover table-condensed">
<thead>
<tr>
<th style="min-width:50px; width:50px">Edit</th>
<th style="min-width:50px; width:50px">Enable</th>
<th style="min-width:200px; width:200px">Role</th>
<th>User Name</th>
</tr>
</thead>
<tbody>
<?php foreach ($users as $user): ?>
<tr>
<td><a href="form.php?id=<?=h($user['id'])?>" class="btn"><i class="icon-pencil"></i></a></td>
<td><a href="status.php?<?=http_build_query(array('id' => $user['id'], 'active' => $user['actived'] == 1 ? '0' : '1'))?>" class="btn"><i class="icon-<?=$user['actived'] == 1 ? 'ok' : 'remove'?>"></i></a></td>
<td><?=h($userRoleOptions[$user['role']])?></td>
<td><?=h($user['username'])?></td>
</tr>
<?php endforeach; ?>
</tbody>
</table>
</form>
<script type="text/javascript">
$(function() {
$('#form').validate();
});
</script>
<?php endif; ?>
<?php require( __DIR__ . '/../inc/_footer.php'); ?>
</div> <!-- /container -->
</body>
</html>