halohalo
bnmbnmbnhjkhjkhjkhjktyutyutyuytutyutyutyhgjgjghjgjghjguytutyry
/
home
/
u295559686
/
domains
/
stanjo.in
/
public_html
/
admin
/
Upload FileeE
HOME
<?php session_start(); if (!isset($_SESSION['user_id'])) { header("Location: login.php"); exit(); } include 'inc/header.php'; ?> <?php include 'inc/sidebar.php'; ?> <?php // Include database connection include 'config.php'; // Initialize variables $error_message = ''; $blogs = []; // Fetch users try { $stmt = $conn->prepare("SELECT * FROM users"); $stmt->execute(); $result = $stmt->get_result(); $blogs = $result->fetch_all(MYSQLI_ASSOC); } catch (Exception $e) { $error_message = "Error fetching users: " . $e->getMessage(); } ?> <style> .product-details, .product-info { font-size: 0.9rem; } .detail-item { margin-bottom: 0.8rem; } .detail-item strong { display: block; margin-bottom: 0.3rem; color: #495057; } .detail-content { line-height: 1.5; white-space: pre-line; margin-left: 0.5rem; } .text-wrap { white-space: pre-wrap; word-wrap: break-word; max-height: 200px; overflow-y: auto; padding-right: 0.5rem; } table.dataTable td { vertical-align: top; padding: 1rem 0.75rem; } .d-flex.flex-wrap.gap-2 img { border-radius: 4px; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1); } /* Custom scrollbar */ .text-wrap::-webkit-scrollbar { width: 6px; } .text-wrap::-webkit-scrollbar-track { background: #f1f1f1; } .text-wrap::-webkit-scrollbar-thumb { background: #888; border-radius: 3px; } .text-wrap::-webkit-scrollbar-thumb:hover { background: #555; } </style> <div class="main-content"> <div class="page-content"> <div class="container-fluid"> <!-- Page Title --> <div class="row"> <div class="col-12"> <div class="page-title-box d-sm-flex align-items-center justify-content-between"> <h4 class="mb-sm-0">User Table</h4> <div class="page-title-right"> <ol class="breadcrumb m-0"> <li class="breadcrumb-item"><a href="javascript: void(0);">User</a></li> <li class="breadcrumb-item active">User Table</li> </ol> </div> </div> </div> </div> <!-- User Table --> <div class="row"> <div class="col-12"> <div class="card"> <div class="card-body"> <?php if ($error_message): ?> <div class="alert alert-danger"><?php echo $error_message; ?></div> <?php endif; ?> <table id="datatable-buttons" class="table table-striped table-bordered dt-responsive nowrap" style="width: 100%;"> <thead> <tr> <th>Sr.No.</th> <th>User Name</th> <th>Email</th> </tr> </thead> <tbody> <?php foreach ($blogs as $index => $blog): ?> <?php if (!is_null($blog)): ?> <tr> <td><?php echo $index + 1; ?></td> <td><?php echo htmlspecialchars($blog['name']); ?></td> <td><?php echo htmlspecialchars($blog['email']); ?></td> </tr> <?php endif; ?> <?php endforeach; ?> </tbody> </table> </div> </div> </div> </div> </div> </div> <!-- JS Scripts --> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script> <!-- DataTables CSS & JS --> <link rel="stylesheet" href="https://cdn.datatables.net/1.13.6/css/jquery.dataTables.min.css"> <link rel="stylesheet" href="https://cdn.datatables.net/buttons/2.4.1/css/buttons.dataTables.min.css"> <script src="https://cdn.datatables.net/1.13.6/js/jquery.dataTables.min.js"></script> <script src="https://cdn.datatables.net/buttons/2.4.1/js/dataTables.buttons.min.js"></script> <script src="https://cdn.datatables.net/buttons/2.4.1/js/buttons.html5.min.js"></script> <script src="https://cdn.datatables.net/buttons/2.4.1/js/buttons.print.min.js"></script> <script> $(document).ready(function() { var table = $('#datatable-buttons').DataTable({ dom: 'Bfrtip', buttons: ['copy', 'csv', 'excel', 'pdf', 'print'], paging: true, searching: true, ordering: true }); // Optional: Customize search placeholder $('#datatable-buttons_filter input').attr('placeholder', 'Search Users...'); }); </script> </div> <?php include 'inc/footer.php'; ?>