[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: role-permissions.php
<?php include("../admin/includes/functions/functions.php");?> <?php include("../admin/db/db.php");?> <?php if(!isset($_SESSION['username_Xw211qAAsq4'])) { header('Location: ../auth/'); exit(); } else{ $pageTitle1 = 'Role Permissions'; $shopname = $_SESSION['business_name_Xw211qAAsq4']; $message = ""; if (isset($_POST['update_permissions'])) { // Loop through the checkboxes using the role_id as the key foreach ($_POST['status'] as $role_id => $value) { // Set checkbox values, default to 0 if not checked $status = isset($_POST['status'][$role_id]) ? $_POST['status'][$role_id] : 0; $add = isset($_POST['add'][$role_id]) ? $_POST['add'][$role_id] : 0; $updaterecord = isset($_POST['updaterecord'][$role_id]) ? $_POST['updaterecord'][$role_id] : 0; $deleterecord = isset($_POST['deleterecord'][$role_id]) ? $_POST['deleterecord'][$role_id] : 0; // Update query using role_id for each checkbox (with backticks around `add`) $stmt_update_service = $con->prepare("UPDATE role_permissions SET status = ?, `add` = ?, updaterecord = ?, deleterecord = ? WHERE role_id = ?"); $stmt_update_service->execute(array($status, $add, $updaterecord, $deleterecord, $role_id)); if (!$stmt_update_service) { echo "Error updating role_id $role_id: " . $con->error; } } $message = '<script> $(document).ready(function(){ swal("Success!", "Permissions updated successfully! ", "success");}); </script>'; } } ?> <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <title><?php echo $shopname;?> - <?php echo $pageTitle1;?></title> <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no"> <meta http-equiv="X-UA-Compatible" content="IE=edge" /> <script src="https://code.jquery.com/jquery-3.6.4.min.js" integrity="sha256-oP6HI9z1XaZNBrJURtCoUT5SUnxFr8s3BzRl+cbzUq8=" crossorigin="anonymous"></script> <link rel="shortcut icon" href="../assets/icon.png" type="image/x-icon"> <link rel="icon" href="../assets/icon.png" type="image/x-icon"> <script src="https://unpkg.com/sweetalert/dist/sweetalert.min.js"></script> <!-- App css --> <link href="assets/css/bootstrap.min.css" rel="stylesheet" type="text/css" /> <link href="assets/css/icons.min.css" rel="stylesheet" type="text/css" /> <link href="assets/css/theme.min.css" rel="stylesheet" type="text/css" /> <style> /* The container */ .container { display: block; position: relative; padding-left: 35px; margin-bottom: 12px; cursor: pointer; font-size: 18px; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; } /* Hide the browser's default checkbox */ .container input { position: absolute; opacity: 0; cursor: pointer; height: 0; width: 0; } /* Create a custom checkbox */ .checkmark { position: absolute; top: 0; left: 0; height: 18px; width: 18px; background-color: #eee; } /* On mouse-over, add a grey background color */ .container:hover input ~ .checkmark { background-color: #ccc; } /* When the checkbox is checked, add a blue background */ .container input:checked ~ .checkmark { background-color: #2196F3; } /* Create the checkmark/indicator (hidden when not checked) */ .checkmark:after { content: ""; position: absolute; display: none; } /* Show the checkmark when checked */ .container input:checked ~ .checkmark:after { display: block; } /* Style the checkmark/indicator */ .container .checkmark:after { left: 9px; top: 5px; width: 5px; height: 10px; border: solid white; border-width: 0 3px 3px 0; -webkit-transform: rotate(45deg); -ms-transform: rotate(45deg); transform: rotate(45deg); } </style> </head> <body> <!-- Begin page --> <div id="layout-wrapper"> <div class="header-border"></div> <?php include("includes/template/head.php");?> <?php include("includes/template/side.php");?> <div class="main-content"> <div class="page-content"> <div class="container-fluid"> <!-- start page title --> <div class="row"> <div class="col-12"> <div class="page-title-box d-flex align-items-center justify-content-between"> <h4 class="mb-0 font-size-18">Role Permissions</h4> <div class="page-title-right"> <ol class="breadcrumb m-0"> <li class="breadcrumb-item"><a href="javascript: void(0);"><?php echo $shopname;?></a></li> <li class="breadcrumb-item active"><?php echo $pageTitle1;?></li> </ol> </div> </div> </div> </div> <!-- end page title --> <div class="row"> <div class="col-12"> <div class="card"> <div class="card-body"> <div class="col-xl-12"> <h6>Admin role</h6> <div id="message" style="color: green;"></div> <br /> <?php echo $message;?> <form method="POST"> <div class="table-responsive"> <table class="table table-striped"> <tr> <th>Page</th> <th>Activate</th> <th>Allow Add</th> <th>Allow Update</th> <th>Allow Delete</th> </tr> <?php $sele = mysqli_query($new, "SELECT * FROM role_permissions WHERE business_name = '$shopname'"); while($rows = mysqli_fetch_array($sele)) { $dbdash = $rows['page_name']; $role_id = $rows['role_id']; $status = $rows['status']; $deleterecord = $rows['deleterecord']; $add = $rows['add']; $updaterecord = $rows['updaterecord']; ?> <tr> <td><?php echo $dbdash; ?></td> <!-- Activate Checkbox --> <td> <input type="hidden" name="status[<?php echo $role_id; ?>]" value="0"> <!-- Hidden input for unchecked state --> <input type="checkbox" name="status[<?php echo $role_id; ?>]" value="1" <?php if($status == 1) echo 'checked'; ?>> </td> <!-- Allow Add Checkbox --> <td> <input type="hidden" name="add[<?php echo $role_id; ?>]" value="0"> <!-- Hidden input for unchecked state --> <input type="checkbox" name="add[<?php echo $role_id; ?>]" value="1" <?php if($add == 1) echo 'checked'; ?>> </td> <!-- Allow Update Checkbox --> <td> <input type="hidden" name="updaterecord[<?php echo $role_id; ?>]" value="0"> <!-- Hidden input for unchecked state --> <input type="checkbox" name="updaterecord[<?php echo $role_id; ?>]" value="1" <?php if($updaterecord == 1) echo 'checked'; ?>> </td> <!-- Allow Delete Checkbox --> <td> <input type="hidden" name="deleterecord[<?php echo $role_id; ?>]" value="0"> <!-- Hidden input for unchecked state --> <input type="checkbox" name="deleterecord[<?php echo $role_id; ?>]" value="1" <?php if($deleterecord == 1) echo 'checked'; ?>> </td> </tr> <?php } ?> </table> </div> <button type="submit" name="update_permissions">Update Permissions</button> </form> </div> </div> </div> </div> </div> </div> <!--end row--> </div> <!-- container-fluid --> </div> <!-- End Page-content --> <?php include("includes/template/newfooter.php");?> </div> <!-- end main content--> </div> <!-- END layout-wrapper --> <!-- Overlay--> <div class="menu-overlay"></div> <script src="assets/js/jquery.min.js"></script> <script src="assets/js/bootstrap.bundle.min.js"></script> <script src="assets/js/metismenu.min.js"></script> <script src="assets/js/waves.js"></script> <script src="assets/js/simplebar.min.js"></script> <script src="plugins/raphael/raphael.min.js"></script> <script src="assets/pages/dashboard-demo.js"></script> <script src="assets/js/theme.js"></script> <script src="assets/pages/datatables-demo.js"></script> </body> </html>
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