[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: side.php
<?php // Retrieve session variables securely $username = $_SESSION['username_Xw211qAAsq4'] ?? ''; $shopname = $_SESSION['business_name_Xw211qAAsq4'] ?? ''; // Function to fetch all permissions for a non-Admin user function getUserPermissions($db, $username, $shopname, $account_type) { $permissions = []; if ($account_type !== 'Owner') { $stmt = $db->prepare("SELECT page_name, status FROM role_permissions WHERE business_name = ? AND type = ?"); $stmt->bind_param("ss", $shopname, $account_type); $stmt->execute(); $result = $stmt->get_result(); while ($row = $result->fetch_assoc()) { $permissions[$row['page_name']] = $row['status'] == '1'; } } return $permissions; } // Function to check if a page is accessible function hasPermission($permissions, $page_name, $isAdmin) { return $isAdmin || (isset($permissions[$page_name]) && $permissions[$page_name]); } // Fetch user account type using PDO (consistent with original) $stmt = $con->prepare("SELECT account_type FROM barber_admin WHERE username = ? AND business_name = ?"); $stmt->execute([$username, $shopname]); $account_type = $stmt->fetch(PDO::FETCH_ASSOC)['account_type'] ?? ''; $isAdmin = $account_type === 'Owner'; // Fetch all permissions for non-Admin users once $permissions = getUserPermissions($new, $username, $shopname, $account_type); ?> <div class="vertical-menu"> <div data-simplebar class="h-100"> <!-- Navbar Brand --> <div class="navbar-brand-box"> <a class="logo"> <i class="mdi mdi-album"></i> <span style="font-size: 15px"><?= htmlspecialchars($shopname) ?></span> </a> <button type="button" class="btn btn-sm mr-2 d-lg-none px-3 font-size-16 header-item waves-effect" id="vertical-menu-btn"> <i class="fa fa-fw fa-bars"></i> </button> </div> <!-- Sidebar Menu --> <div id="sidebar-menu"> <ul class="metismenu list-unstyled" id="side-menu"> <li class="menu-title">Menu</li> <li> <a href="index.php" class="waves-effect"> <i class="mdi mdi-home-analytics"></i> <span>Dashboard</span> </a> </li> <!-- Services Sales Submenu --> <li> <a href="javascript:void(0);" class="has-arrow waves-effect"> <i class="mdi mdi-table-merge-cells"></i> <span>Services</span> </a> <ul class="sub-menu" aria-expanded="false"> <?php if (hasPermission($permissions, 'Service Category', $isAdmin)): ?> <li><a href="service-category">Category</a></li> <?php endif; ?> <?php if (hasPermission($permissions, 'Service', $isAdmin)): ?> <li><a href="services">All Service</a></li> <?php endif; ?> </ul> </li> <!-- Services Sales Submenu --> <li> <a href="javascript:void(0);" class="has-arrow waves-effect"> <i class="mdi mdi-table-merge-cells"></i> <span>Sales</span> </a> <ul class="sub-menu" aria-expanded="false"> <?php if (hasPermission($permissions, 'In-House Sales', $isAdmin)): ?> <li><a href="today-sales">Service sales</a></li> <?php if (hasPermission($permissions, 'Product Stock', $isAdmin)): ?> <li><a href="pos">Product sales</a></li> <?php endif; ?> <li><a href="copy_appointment">Online Booking</a></li> <?php endif; ?> <!--<?php if (hasPermission($permissions, 'Online Appointments', $isAdmin)): ?>--> <!-- <li><a href="sales">All Sales</a></li>--> <!--<?php endif; ?>--> </ul> </li> <!-- Products Submenu --> <li> <a href="javascript:void(0);" class="has-arrow waves-effect"> <i class="mdi mdi-table-merge-cells"></i> <span>Products</span> </a> <ul class="sub-menu" aria-expanded="false"> <?php if (hasPermission($permissions, 'Suppliers', $isAdmin)): ?> <li><a href="suppliers">Suppliers</a></li> <?php endif; ?> <?php if (hasPermission($permissions, 'Product Stock', $isAdmin)): ?> <li><a href="product-stock">Product Stock</a></li> <?php endif; ?> <?php if (hasPermission($permissions, 'Product Sales', $isAdmin)): ?> <li><a href="product-sales">Product Sales</a></li> <?php endif; ?> <?php if (hasPermission($permissions, 'Product Out of Stock', $isAdmin)): ?> <li><a href="out-of-stock">Out of Stock</a></li> <?php endif; ?> <?php if (hasPermission($permissions, 'Add New Stock', $isAdmin)): ?> <li><a href="add-new-stock">Add New Stock</a></li> <?php endif; ?> </ul> </li> <!-- Purchases Submenu --> <li> <a href="javascript:void(0);" class="has-arrow waves-effect"> <i class="mdi mdi-black-mesa"></i> <span>Purchases</span> </a> <ul class="sub-menu" aria-expanded="false"> <?php if (hasPermission($permissions, 'Vendors', $isAdmin)): ?> <li><a href="vendors">Vendors</a></li> <?php endif; ?> <?php if (hasPermission($permissions, 'Expenses', $isAdmin)): ?> <li><a href="add-new-stock">Purchase Order</a></li> <li><a href="expenses">Expenses</a></li> <?php endif; ?> </ul> </li> <!-- Admin Booking --> <?php if (hasPermission($permissions, 'Admin Booking', $isAdmin)): ?> <li> <a href="admin_booking" class="waves-effect"> <i class="mdi mdi-calendar-check"></i> <span>Admin Booking</span> </a> </li> <?php endif; ?> <li class="menu-title">More</li> <!-- Staff Submenu --> <li> <a href="javascript:void(0);" class="has-arrow waves-effect"> <i class="mdi mdi-format-page-break"></i> <span>Staff</span> </a> <ul class="sub-menu" aria-expanded="false"> <?php if (hasPermission($permissions, 'Employee', $isAdmin)): ?> <li><a href="department">Department</a></li> <li><a href="employees">Employees</a></li> <?php endif; ?> <li><a href="employee-schedule">Employees Schedule</a></li> <?php if (hasPermission($permissions, 'Commission Rate', $isAdmin)): ?> <li><a href="commission-rate">Commission Rate</a></li> <?php endif; ?> <?php if (hasPermission($permissions, 'Payroll', $isAdmin)): ?> <li><a href="payroll">Record Payroll</a></li> <?php endif; ?> <?php if (hasPermission($permissions, 'Manage Users', $isAdmin)): ?> <li><a href="manage-users">Account Managers</a></li> <?php endif; ?> <?php if (hasPermission($permissions, 'Role Permissions', $isAdmin)): ?> <li><a href="role-permissions">Role Permission</a></li> <?php endif; ?> </ul> </li> <!-- Customers --> <?php if (hasPermission($permissions, 'Customers', $isAdmin)): ?> <li> <a href="customers" class="waves-effect"> <i class="mdi mdi-calendar-range-outline"></i> <span>Customers</span> </a> </li> <?php endif; ?> <!-- Marketing Campaign Submenu --> <li> <a href="javascript:void(0);" class="has-arrow waves-effect"> <i class="mdi mdi-format-page-break"></i> <span>Campaigns</span> </a> <ul class="sub-menu" aria-expanded="false"> <!--<li><a href="sms-api">Setup SMS API</a></li>--> <li><a href="bulk-sms">Send Bulk SMS</a></li> </ul> </li> <!-- Reports Submenu --> <li> <a href="javascript:void(0);" class="has-arrow waves-effect"> <i class="mdi mdi-poll"></i> <span>Reports</span> </a> <ul class="sub-menu" aria-expanded="true"> <?php if (hasPermission($permissions, 'Sales Report', $isAdmin)): ?> <li><a href="sales_report">Sales Report</a></li> <?php endif; ?> <?php if (hasPermission($permissions, 'Commission Rate', $isAdmin)): ?> <li><a href="comission_report">Commission Report</a></li> <?php endif; ?> <?php if (hasPermission($permissions, 'Expenses Report', $isAdmin)): ?> <li><a href="expenses_report">Expenses Report</a></li> <?php endif; ?> <?php if (hasPermission($permissions, 'Customers Report', $isAdmin)): ?> <li><a href="customer_report">Customer Report</a></li> <?php endif; ?> <?php if (hasPermission($permissions, 'Products Report', $isAdmin)): ?> <li><a href="product_report">Products Report</a></li> <?php endif; ?> </ul> </li> </ul> </div> <!-- End Sidebar --> </div> </div>
Save Changes
Cancel / Back
Close ×
Server Info
Hostname: server1.winmanyltd.com
Server IP: 203.161.60.52
PHP Version: 8.3.27
Server Software: Apache
System: Linux server1.winmanyltd.com 4.18.0-553.22.1.el8_10.x86_64 #1 SMP Tue Sep 24 05:16:59 EDT 2024 x86_64
HDD Total: 117.98 GB
HDD Free: 59.81 GB
Domains on IP: N/A (Requires external lookup)
System Features
Safe Mode:
Off
disable_functions:
None
allow_url_fopen:
On
allow_url_include:
Off
magic_quotes_gpc:
Off
register_globals:
Off
open_basedir:
None
cURL:
Enabled
ZipArchive:
Enabled
MySQLi:
Enabled
PDO:
Enabled
wget:
Yes
curl (cmd):
Yes
perl:
Yes
python:
Yes (py3)
gcc:
Yes
pkexec:
Yes
git:
Yes
User Info
Username: eliosofonline
User ID (UID): 1002
Group ID (GID): 1003
Script Owner UID: 1002
Current Dir Owner: 1002