| Server IP : 167.235.67.158 / Your IP : 216.73.216.95 Web Server : Apache System : Linux ubuntu-8gb-nbg1-1 6.8.0-111-generic #111-Ubuntu SMP PREEMPT_DYNAMIC Sat Apr 11 23:16:02 UTC 2026 x86_64 User : upstairsbar.co.uk ( 982) PHP Version : 8.3.6 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : OFF Directory : /var/www/drivebuddi.the-word.com/ |
Upload File : |
<?php
error_reporting(E_ALL);
ini_set('display_errors', '1');
include($_SERVER['DOCUMENT_ROOT'] . "/incs/db.php");
if(!UserManager::isUserLoggedIn($db)) Utils::redirect("/login.php");
if(!UserManager::currentUserCan($db, 'create_users')) Utils::redirect("/index.php");
$limit = 20;
$pageNumber = 0;
$orderby = 'Email';
$order = 'ASC';
$search = '';
$role = 0;
$enabled = 0;
if(isset($_GET['page']))
$pageNumber = $_GET['page'] - 1;
if(isset($_GET['orderby']))
$orderby = $_GET['orderby'];
if(isset($_GET['order']))
$order = $_GET['order'];
if(isset($_GET['search']))
$search = $_GET['search'];
if(isset($_GET['role']))
$role = $_GET['role'];
if(isset($_GET['enabled']))
$enabled = $_GET['enabled'];
if(!UserManager::currentUserCan($db, 'show_all_users'))
$company = $userCompany->id;
$searchArr = array('search'=>$search, 'role'=>$role, 'enabled' => $enabled);
$usersDetails = UserManager::getUsers($db, $limit, $pageNumber, $orderby, $order, $searchArr);
$userCount = $usersDetails->userCount;
$users = $usersDetails->users;
$roles = UserManager::getRoles($db);
$rolesList = $roles->roles;
$roles = array();
foreach($rolesList as $rl)
$roles[$rl->ID] = $rl;
$showingStart = $pageNumber*$limit + 1;
$showingEnd = $pageNumber*$limit + $limit;
if($showingEnd > $userCount) $showingEnd = $userCount;
$paging = Utils::createPaging($pageNumber+1, $limit, $userCount, $_SERVER['REQUEST_URI']);
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>Users - PDA</title>
<?php include($_SERVER['DOCUMENT_ROOT'] . "/incs/head.php")?>
</head>
<body>
<?php include($_SERVER['DOCUMENT_ROOT'] . "/incs/menu.php");?>
<div class="container mainsection">
<div class="page-header">
<h3>User Manager</h3>
</div>
<form class="form-inline" role="form" action="" method="get">
<div class="form-group"><input type="text" placeholder="Search..." name="search" class="form-control"></div>
<div class="form-group">
<label class="sr-only" for="role">Role</label>
<select class="form-control" name="role">
<option value="">All Roles</option>
<?php foreach($roles as $r) { if(UserManager::currentUserHasPermission($db, $r->PermissionNeeded)) { ?>
<option value="<?php echo $r->ID; ?>"><?php echo $r->Name; ?></option>
<?php } } ?>
</select>
</div>
<div class="form-group">
<label class="sr-only" for="role">Status</label>
<select class="form-control" name="enabled">
<option value="both">Enabled & Disabled</option>
<option value="enabled">Enabled</option>
<option value="disabled">Disabled</option>
</select>
</div>
<button type="submit" class="btn btn-default">Search</button>
<!--<button type="submit" class="btn btn-default">Download (csv)</button>-->
</form>
<!-- Main component for a primary marketing message or call to action -->
<p style="padding-top: 10px;"><button class="btn btn-success" id="btnCreate">Create</button> a new user</p>
<div class="row">
<div class="col-md-12">
<table id="tbUserDetails" class="table table-striped table-bordered table-hover">
<?php if($userCount > 0) { ?>
<thead><tr><th>Email</th><th>Name</th><th>Role</th><th> </th></tr></thead>
<tbody>
<?php
foreach($users as $user) {
?>
<tr><td><?php echo $user->Email;?></td><td><?php echo $user->Name; ?></td><td><?php echo $roles[$user->Role]->Name;?></td><td><input type="button" class="btn btn-success btnEdit" data-id="<?php echo $user->ID;?>" data-type="Login" value="Edit"> <?php if($user->Enabled) { ?><input type="button" class="btn btn-warning btnDisable" data-id="<?php echo $user->ID;?>" data-type="Login" value="Disable"> <?php } else { ?><input type="button" class="btn btn-primary btnEnable" data-id="<?php echo $user->ID;?>" data-type="Login" value="Enable"><?php } ?> <input type="button" class="btn btn-danger btnDelete" data-id="<?php echo $user->ID;?>" data-type="Login" value="Delete"></td></tr>
<?php
}
?>
</tbody>
<tfoot>
<tr><th colspan="6" style="text-align: center">
Showing <?php echo $showingStart; ?>-<?php echo $showingEnd; ?> of <?php echo $userCount ?> result(s)
<div class="paging">Page Select: <?php echo $paging; ?></div>
</th></tr>
</tfoot>
<?php } else { ?>
<thead><tr><th>No users found for this criteria.</th></tr></thead>
<?php } ?>
</table>
</div>
</div>
</div>
<!-- /container -->
<div id="EditModal" class="modal fade" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" >
<div class="modal-dialog">
<div class="modal-content">
<form id="editForm">
<div class="modal-header">
<a id="aNewEditClose" href="#" aria-hidden="true" style="float:right">x</a>
<h4 class="modal-title">New / Edit</h4>
</div>
<div class="modal-body">
<input type="hidden" id="editId" />
<input type="hidden" id="etype" value="Login" />
<ul class="nav nav-tabs">
<li class="active"><a href="#tMain" data-toggle="tab">Basic Details</a></li>
<li class=""><a href="#tCredentials" data-toggle="tab">Credentials</a></li>
</ul>
<div class="tab-content">
<div class="tab-pane active" id="tMain">
<table id="Table1" class="table table-striped table-bordered">
<thead>
<tr>
<th>Name*</th>
<td><input id="txtName" type="text" class="form-control required" placeholder="Name" size="50" style="width: 200px;" /></td>
</tr>
<tr>
<th>Email*</th>
<td><input id="txtEmail" type="text" class="form-control required" placeholder="Email" size="254" style="width: 200px;" /></td>
</tr>
<tr>
<th>Telephone*</th>
<td><input id="txtTelephone" type="text" class="form-control required" placeholder="Telephone #" size="254" style="width: 200px;" /></td>
</tr>
<tr>
<th>Vehicle Registration*</th>
<td><input id="txtVehicleReg" type="text" class="form-control required" placeholder="Vehicle Registration" size="254" style="width: 200px;" /></td>
</tr>
<tr>
<th>DOB*</th>
<td><input id="txtDOB" type="date" class="form-control required"></td>
</tr>
<tr>
<th>Role*</th>
<td>
<select class="form-control required" id="selectRole" required>
<option value="">Please Select</option>
<?php foreach($roles as $r) { if(UserManager::currentUserHasPermission($db, $r->PermissionNeeded)) { ?>
<option value="<?php echo $r->ID; ?>"><?php echo $r->Name; ?></option>
<?php } } ?>
</select>
</td>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
<div class="tab-pane" id="tCredentials">
<table id="Table1" class="table table-striped table-bordered">
<thead>
<tr>
<th>Password</th>
<td><input id="txtPassword" type="password" class="form-control required createRequired" placeholder="Password" size="50" style="width: 200px;" /></td>
</tr>
</thead>
<tbody>
</tbody>
</table>
</div>
</div>
</div>
<div class="modal-footer">
<input id="btnSave" type='button' class='btn btn-primary' value='Save'/>
<input id="btnClose" type='button' class='btn btn-success' value='Close' />
</div>
</form>
</div>
<!-- /.modal-content -->
</div>
<!-- /.modal-dialog -->
</div>
</div>
<?php
include($_SERVER['DOCUMENT_ROOT'] . "/incs/footer.php");
?>
</body>
</html>