[
MAINHACK
]
Mail Test
BC
Config Scan
HOME
Create...
New File
New Folder
Viewing / Editing File: manage-users.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 = 'Manage users'; $shopname = $_SESSION['business_name_Xw211qAAsq4']; $notificationType = "success"; $message = ""; if(isset($_POST['add'])){ $username = test_input($_POST['username']); $full_name = test_input($_POST['full_name']); $email = test_input($_POST['email']); $phone_number = test_input($_POST['phone_number']); $password = test_input($_POST['password']); $status = test_input($_POST['status']); if($username == ""){ $message = '<script> $(document).ready(function(){ swal("Warning!", "Please enter username", "warning");}); </script>'; } if($full_name == ""){ $message = '<script> $(document).ready(function(){ swal("Warning!", "Please enter fullname", "warning");}); </script>'; } if($email==""){ $message = '<script> $(document).ready(function(){ swal("Warning!", "Please enter Email", "warning");}); </script>'; } if($password==""){ $message = '<script> $(document).ready(function(){ swal("Warning!", "Please enter Password", "warning");}); </script>'; } if(!$message){ $options = ['cost' => 12,]; $hashed_password = password_hash($password, PASSWORD_BCRYPT, $options); $validation_code = md5($email . microtime()); $sele = mysqli_query($new,"SELECT * FROM barber_admin WHERE business_name = '$shopname' and account_type = 'Owner'"); $fetch = mysqli_fetch_array($sele); $location = $fetch['location']; $forgot_pass_expire_time = $fetch['forgot_pass_expire_time']; $expired = $fetch['expired']; $open_clode_time = $fetch['open_clode_time']; $account_status = $fetch['account_status']; $account_type = 'Admin'; $stmt = $con->prepare("insert into barber_admin (username,email,full_name,password,validation_code,active,forgot_pass_expire_time,phone,business_name,location,account_type,expired,open_clode_time,account_status) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?)"); $stmt->execute(array($username,$email,$full_name,$hashed_password,$validation_code,$status,$forgot_pass_expire_time,$phone_number,$shopname,$location,$account_type,$expired,$open_clode_time,$account_status)); $message = '<script> $(document).ready(function(){ swal("Success!", "New account manager is added", "success");}); </script>'; } } if(isset($_POST['del'])){ $SID = filter_input(INPUT_POST, 'SID', FILTER_SANITIZE_STRING); $SID = htmlspecialchars($SID, ENT_QUOTES, 'UTF-8'); $stmt = $con->prepare("DELETE FROM barber_admin WHERE admin_id = ?"); $stmt->execute(array($SID)); $message = '<script> $(document).ready(function(){ swal("Success!", "New account manager is deleted", "success");}); </script>'; //header("Location: manage-users"); } if(isset($_POST['update'])){ $username = test_input($_POST['username']); $full_name = test_input($_POST['full_name']); $email = test_input($_POST['email']); $phone = test_input($_POST['phone']); $password = test_input($_POST['password']); $status = test_input($_POST['status']); $admin_id = test_input($_POST['admin_id']); $options = ['cost' => 12,]; $hashed_password = password_hash($password, PASSWORD_BCRYPT, $options); $stmt_update_service = $con->prepare("UPDATE barber_admin SET username = ?, email = ?, full_name = ?, password = ?, phone = ?,active = ? WHERE admin_id = ?"); $stmt_update_service->execute(array($username,$email,$full_name,$hashed_password,$phone,$status,$admin_id)); $message = '<script> $(document).ready(function(){ swal("Success!", "New account manager is updated", "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" /> <link href="plugins/datatables/dataTables.bootstrap4.css" rel="stylesheet" type="text/css" /> <link href="plugins/datatables/responsive.bootstrap4.css" rel="stylesheet" type="text/css" /> <link href="plugins/datatables/buttons.bootstrap4.css" rel="stylesheet" type="text/css" /> <link href="plugins/datatables/select.bootstrap4.css" rel="stylesheet" type="text/css" /> <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://code.jquery.com/jquery-3.6.4.min.js" integrity="sha256-oP6HI9z1XaZNBrJURtCoUT5SUnxFr8s3BzRl+cbzUq8=" crossorigin="anonymous"></script> <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> #preloader { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 9999; background-color: #fff; } #loader { display: block; position: absolute; top: 50%; left: 50%; border: 16px solid #f3f3f3; border-top: 16px solid #3498db; border-radius: 50%; width: 70px; height: 70px; animation: spin 2s linear infinite; } @keyframes spin { 0% { transform: rotate(0deg); } 100% { transform: rotate(360deg); } } </style> </head> <body> <div id="preloader"> <div id="loader"></div> </div> <!-- 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"> <?php if($message != "") { echo ($message) ; } ?> <h4 class="mb-0 font-size-18">All users</h4> <div class="page-title-right"> <ol class="breadcrumb m-0"> <li class="breadcrumb-item"><a href="javascript: void(0);"><?= $shopname;?></a></li> <li class="breadcrumb-item active"><?php echo $pageTitle;?></li> </ol> </div> </div> </div> </div> <!-- end page title --> <div class="row"> <div class="col-lg-12"> <div class="card"> <div class="card-body"> <?php $sow = mysqli_query($new,"SELECT * FROM barber_admin WHERE business_name = '$shopname'"); $userA = mysqli_fetch_array($sow); $userA_Master = $userA['master_account']; $soww = mysqli_query($new,"SELECT * FROM barber_admin WHERE master_account = '$userA_Master'"); $userB = mysqli_fetch_array($soww); $count = mysqli_num_rows($soww); $account = $userB['account_status']; $stmt = $con->prepare("SELECT account_type FROM barber_admin WHERE username = ? and business_name = ?"); $stmt->execute(array($username,$shopname)); $userstatus = $stmt->fetchAll(); foreach($userstatus as $sta) { $namee = $sta['account_type']; } $select_role = mysqli_query($new,"SELECT * FROM role_permissions WHERE business_name = '$shopname' and type = '$namee' and page_name = 'Manage Users'"); $rowroles = mysqli_fetch_array($select_role); $updaterecord = $rowroles['updaterecord']; $deleterecord = $rowroles['deleterecord']; $add_db = $rowroles['add']; $type = $rowroles['type']; if($account == 'Trial' and $count >= 2){?> <?php if($namee != "Admin"){?> <button type="button" class="btn btn-primary waves-effect waves-light" data-toggle="modal" data-target=".bd-example-modal-lg">Add</button> <!-- <button type="button" disabled class="btn btn-primary waves-effect waves-light">Add Service</button> --> <?php } elseif($namee == "Admin" and $add_db == '1' ) {?> <button type="button" class="btn btn-primary waves-effect waves-light" data-toggle="modal" data-target=".bd-example-modal-lg">Add</button> <?php } elseif ($namee == "Admin" and $add_db == '0'){?> <button type="button" disabled class="btn btn-primary waves-effect waves-light">Add</button> <?php }?> <?php } elseif($account == 'Essential' and $count <= 2){?> <?php if($namee != "Admin"){?> <button type="button" class="btn btn-primary waves-effect waves-light" data-toggle="modal" data-target=".bd-example-modal-lg">Add</button> <!-- <button type="button" disabled class="btn btn-primary waves-effect waves-light">Add Service</button> --> <?php } elseif($namee == "Admin" and $add_db == '1' ) {?> <button type="button" class="btn btn-primary waves-effect waves-light" data-toggle="modal" data-target=".bd-example-modal-lg">Add</button> <?php } elseif ($namee == "Admin" and $add_db == '0'){?> <button type="button" disabled class="btn btn-primary waves-effect waves-light">Add</button> <?php }?> <?php } elseif($account == 'Deluxe' and $count <= 5){?> <?php if($namee != "Admin"){?> <button type="button" class="btn btn-primary waves-effect waves-light" data-toggle="modal" data-target=".bd-example-modal-lg">Add</button> <!-- <button type="button" disabled class="btn btn-primary waves-effect waves-light">Add Service</button> --> <?php } elseif($namee == "Admin" and $add_db == '1' ) {?> <button type="button" class="btn btn-primary waves-effect waves-light" data-toggle="modal" data-target=".bd-example-modal-lg">Add</button> <?php } elseif ($namee == "Admin" and $add_db == '0'){?> <button type="button" disabled class="btn btn-primary waves-effect waves-light">Add</button> <?php }?> <?php }elseif($account == 'Lifetime' and $count <= 10){?> <?php if($namee != "Admin"){?> <button type="button" class="btn btn-primary waves-effect waves-light" data-toggle="modal" data-target=".bd-example-modal-lg">Add</button> <!-- <button type="button" disabled class="btn btn-primary waves-effect waves-light">Add Service</button> --> <?php } elseif($namee == "Admin" and $add_db == '1' ) {?> <button type="button" class="btn btn-primary waves-effect waves-light" data-toggle="modal" data-target=".bd-example-modal-lg">Add</button> <?php } elseif ($namee == "Admin" and $add_db == '0'){?> <button type="button" disabled class="btn btn-primary waves-effect waves-light">Add</button> <?php }?> <?php }?> <br /><br /> <div class="table-responsive"> <table id="basic-datatable" class="table table-hover table-striped table-bordered"> <thead style="background-color:#428bca;border:#428bca;"> <tr style="color: #ffffff;"> <th>ID</th> <th>Username</th> <th>Full name</th> <th>Info</th> <th>Status</th> <th>Action</th> </tr> </thead> <tbody> <?php $cont = 1; // $account_type = 'Admin'; $stmt = $con->prepare("SELECT * FROM barber_admin WHERE business_name = ? ORDER BY admin_id DESC"); $stmt->execute(array($shopname)); $rows_services = $stmt->fetchAll(); ?> <tr> <?php foreach($rows_services as $service){ ?> <td><?php echo $cont++;?></td> <td><?php echo $service['username'];?></td> <td><?php echo $service['full_name'];?></td> <td class="py-0 px-1"> <small>Account type : <?php echo $service['account_type'] ?></small><br> <small>Email: <?php echo $service['email'];?></small><br> <small>Phone : <?php echo $service['phone'];?></small><br> </td> <td> <?php if($service['active'] == 1): ?> <span class="badge bg-success rounded-pill" style="color:#fff">Active</span> <?php else: ?> <span class="badge bg-danger rounded-pill" style="color:#fff">Inactive</span> <?php endif; ?> </td> <td> <?php $edit_data = "edit_".$service["admin_id"];?> <?php $delete_data = "delete_".$service["admin_id"];?> <?php if($namee != "Admin"){?> <li class="list-inline-item" data-toggle="tooltip" title="Edit"> <a href="#" data-toggle="modal" data-target="#<?php echo $edit_data; ?>" data-placement="top"><i class="fa fa-edit"></i></a> </li> <!-- <button type="button" disabled class="btn btn-primary waves-effect waves-light">Add Service</button> --> <?php } elseif($namee == "Admin" and $updaterecord == '1' ) {?> <li class="list-inline-item" data-toggle="tooltip" title="Edit"> <a href="#" data-toggle="modal" data-target="#<?php echo $edit_data; ?>" data-placement="top"><i class="fa fa-edit"></i></a> </li> <?php } elseif ($namee == "Admin" and $updaterecord == '0'){?> <li class="list-inline-item" data-toggle="tooltip" title="Locked"> <a class="disabled" data-placement="top"><i class="fa fa-edit"></i></a> </li> <?php }?> <?php if($namee != "Admin"){?> <li class="list-inline-item" data-toggle="tooltip" title="Delete"> <a href="#" data-toggle="modal" data-target="#<?php echo $delete_data; ?>" data-placement="top"><i class="fa fa-trash-alt" style="color:red"></i></a> </li> <!-- <button type="button" disabled class="btn btn-primary waves-effect waves-light">Add Service</button> --> <?php } elseif($namee == "Admin" and $deleterecord == '1' ) {?> <li class="list-inline-item" data-toggle="tooltip" title="Delete"> <a href="#" data-toggle="modal" data-target="#<?php echo $delete_data; ?>" data-placement="top"><i class="fa fa-trash-alt" style="color:red"></i></a> </li> <?php } elseif ($namee == "Admin" and $deleterecord == '0'){?> <li class="list-inline-item" data-toggle="tooltip" title="Locked"> <a class="disabled" data-placement="top"><i class="fa fa-trash-alt" style="color:red"></i></a> </li> <?php }?> <!-- <li class="list-inline-item" data-toggle="tooltip" title="Edit"> <a href="#" data-toggle="modal" data-target="#<?php echo $edit_data; ?>" data-placement="top"><i class="fa fa-edit"></i></a> </li> <li class="list-inline-item" data-toggle="tooltip" title="Delete"> <a href="#" data-toggle="modal" data-target="#<?php echo $delete_data; ?>" data-placement="top"><i class="fa fa-trash-alt"style="color:red" ></i></a> </li> --> </li> <ul> <!-- EDIT Modal --> <div class="modal fade" id="<?php echo $delete_data; ?>" tabindex="-1" role="dialog" aria-labelledby="<?php echo $delete_data; ?>" aria-hidden="true"> <div class="modal-dialog" role="document"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="exampleModalLabel">Delete Employee</h5> <button type="button" class="close" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body"> <form method="POST"> Are you sure you want to delete this User? </div> <input type="hidden" name="SID" value="<?php echo $service['admin_id']; ?>"> <div class="modal-footer"> <button type="button" class="btn btn-secondary" data-dismiss="modal">Cancel</button> <button type="submit" name="del" class="btn btn-success">Delete</button> </form> </div> </div> </div> </div> <div class="modal fade bd-example-modal-lg12" id="<?php echo $edit_data; ?>" tabindex="-1" role="dialog" aria-labelledby="<?php echo $edit_data; ?>" aria-hidden="true"> <div class="modal-dialog modal-lg"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title h4" id="myLargeModalLabel">Edit User</h5> <button type="button" class="close waves-effect waves-light" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> <div id="response"></div> </div> <div class="modal-body"> <form method="post" accept-charset="utf-8"> <div class="row"> <div class="form-group col-md-6"> <label>Username</label> <input type="text" name="username" value="<?php echo $service["username"]; ?>" class="form-control" style="height:40px"> </div> <div class="form-group col-md-6"> <label>Full name</label> <input type="text" name="full_name" value="<?php echo $service["full_name"]; ?>" class="form-control" style="height:40px"> </div> <input type="hidden" name="admin_id" value="<?php echo $service["admin_id"]; ?>"> <div class="form-group col-md-6"> <label>Email</label> <input type="email" name="email" value="<?php echo $service["email"]; ?>" class="form-control" style="height:40px"> </div> <div class="form-group col-md-6"> <label>Phone number</label> <input type="number" name="phone" value="<?php echo $service["phone"]; ?>" class="form-control" style="height:40px"> </div> <div class="form-group col-md-6"> <label>Select status</label> <select class="form-control" name="status" required> <option value=""></option> <option value="1">Active</option> <option value="0">Inactive</option> </select> </div> <div class="form-group col-md-6"> <label>Password</label> <input type="password" name="password" class="form-control" style="height:40px" required> </div> <div class="form-group col-md-2"> <button type="submit" name="update" class="btn btn-success form-control">Save</button> </div> </div> </form> </div> </div> </div> </div> </li> </ul> </td> </tr> <?php };?> </tbody> </table> </div> </div> <!--end card body--> </div> <!-- end card--> </div> <!-- end col --> </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> <?php //include("includes/modals/UserModal.php");?> <div class="modal fade bd-example-modal-lg" tabindex="-1" role="dialog" aria-labelledby="myLargeModalLabel" aria-hidden="true"> <div class="modal-dialog modal-lg"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title h4" id="myLargeModalLabel">Add New User</h5> <button type="button" class="close waves-effect waves-light" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body"> <form method="post" accept-charset="utf-8"> <div class="row"> <div class="form-group col-md-6"> <label>username</label> <input type="text" name="username" class="form-control" style="height:40px" autocomplete="off"> </div> <div class="form-group col-md-6"> <label>Full name</label> <input type="text" name="full_name" class="form-control" style="height:40px" autocomplete="off"> </div> <div class="form-group col-md-6"> <label>Email</label> <input type="email" name="email" class="form-control" style="height:40px" autocomplete="off"> </div> <div class="form-group col-md-6"> <label>Phone number</label> <input type="number" name="phone_number" class="form-control" style="height:40px" autocomplete="off"> </div> <div class="form-group col-md-6"> <label>Password</label> <input type="password" name="password" class="form-control" style="height:40px"> </div> <div class="form-group col-md-6"> <label>Select status</label> <select class="form-control" name="status" required> <option value=""></option> <option value="1">Active</option> <option value="0">Inactive</option> </select> </div> <div class="form-group col-md-2"> <br/><br/> <button type="submit" name="add" class="btn btn-success form-control">Send</button> </div> </div> </form> </div> </div> </div> </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="plugins/datatables/jquery.dataTables.min.js"></script> <script src="plugins/datatables/dataTables.bootstrap4.js"></script> <script src="plugins/datatables/dataTables.responsive.min.js"></script> <script src="plugins/datatables/responsive.bootstrap4.min.js"></script> <script src="plugins/datatables/dataTables.buttons.min.js"></script> <script src="plugins/datatables/buttons.bootstrap4.min.js"></script> <script src="plugins/datatables/dataTables.keyTable.min.js"></script> <script src="plugins/datatables/dataTables.select.min.js"></script> <script src="assets/pages/datatables-demo.js"></script> <script type="text/javascript"> document.onreadystatechange = function() { if (document.readyState !== "complete") { document.querySelector("#preloader").style.display = "block"; } else { document.querySelector("#preloader").style.display = "none"; } }; </script> <!-- jQuery --> </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.76 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