403Webshell
Server IP : 43.241.58.20  /  Your IP : 216.73.216.25
Web Server : Apache/2
System : Linux ns1-1556229.dragonhispeed.com 3.16.0 #1 SMP Fri Mar 29 22:50:14 MSK 2024 x86_64
User : ratsitne ( 1130)
PHP Version : 5.6.40
Disable Function : exec,system,passthru,shell_exec,proc_close,proc_open,dl,popen,show_source,posix_kill,posix_mkfifo,posix_getpwuid,posix_setpgid,posix_setsid,posix_setuid,posix_setgid,posix_seteuid,posix_setegid,posix_uname
MySQL : ON  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /home/ratsitne/.trash/files/admin.1/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /home/ratsitne/.trash/files/admin.1/customer-list.php
<?php
include '../config.php';
include 'auth.php';
$page_title = 'ลูกค้า';
ob_start();

// Handle search
$search_keyword = isset($_GET['search_keyword']) ? $_GET['search_keyword'] : '';

// Pagination settings
$limit = 10;
$page = isset($_GET['page']) ? $_GET['page'] : 1;
$offset = ($page - 1) * $limit;

// Build query
$query = "SELECT * FROM customers WHERE 1=1";
if ($search_keyword) {
    $query .= " AND (company_name LIKE '%$search_keyword%' OR contact_name LIKE '%$search_keyword%' OR tax_id LIKE '%$search_keyword%')";
}
$query .= " ORDER BY id DESC LIMIT $limit OFFSET $offset";
$result = mysqli_query($conn, $query);

// Get total records for pagination
$total_query = "SELECT COUNT(*) as total FROM customers WHERE 1=1";
if ($search_keyword) {
    $total_query .= " AND (company_name LIKE '%$search_keyword%' OR contact_name LIKE '%$search_keyword%' OR tax_id LIKE '%$search_keyword%')";
}
$total_result = mysqli_query($conn, $total_query);
$total_row = mysqli_fetch_assoc($total_result);
$total_records = $total_row['total'];
$total_pages = ceil($total_records / $limit);
?>
<div class="card">
    <div class="card-header">
        <h3 class="card-title">รายการลูกค้า</h3>
        <div class="card-tools">
        <a href="<?php echo $admin_url; ?>/customer-add.php" class="btn btn-primary">เพิ่มลูกค้า</a>
        </div>
    </div>
    <div class="card-body">
        <?php if (isset($_SESSION['success_message'])): ?>
            <div class="alert alert-success alert-dismissible fade show">
                <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
                <i class="bi bi-check-circle me-1"></i>
                <?php echo $_SESSION['success_message']; unset($_SESSION['success_message']); ?>
            </div>
        <?php endif; ?>

        <?php if (isset($_SESSION['error_message'])): ?>
            <div class="alert alert-danger alert-dismissible fade show">
                <button type="button" class="btn-close" data-bs-dismiss="alert" aria-label="Close"></button>
                <i class="bi bi-exclamation-triangle me-1"></i>
                <?php echo $_SESSION['error_message']; unset($_SESSION['error_message']); ?>
            </div>
        <?php endif; ?>
        
        <form method="GET" class="mb-3">
            <div class="row">
                <div class="col-md-8">
                    <input type="text" name="search_keyword" class="form-control" placeholder="ค้นหาชื่อบริษัท, ชื่อผู้ติดต่อ, เลขประจำตัวผู้เสียภาษี" value="<?php echo $search_keyword; ?>">
                </div>
                <div class="col-md-4">
                    <button type="submit" class="btn btn-primary">ค้นหา</button>
                </div>
            </div>
        </form>
        <div class="table-responsive">
            <table class="table table-striped">
                <thead>
                    <tr>
                        <th>ID</th>
                        <th>ชื่อบริษัท</th>
                        <th>ผู้ติดต่อ</th>
                        <th>เบอร์โทร</th>
                        <th>อีเมล</th>
                        <th>เลขประจำตัวผู้เสียภาษี</th>
                        <th style="width: 200px;">&nbsp;</th>
                    </tr>
                </thead>
                <tbody>
                    <?php if (mysqli_num_rows($result) > 0): ?>
                        <?php while ($row = mysqli_fetch_assoc($result)): ?>
                            <tr>
                                <td><?php echo $row['id']; ?></td>
                                <td><?php echo $row['company_name']; ?></td>
                                <td><?php echo $row['contact_name']; ?></td>
                                <td><?php echo $row['mobile_phone'] ?: $row['office_phone']; ?></td>
                                <td><?php echo $row['email']; ?></td>
                                <td><?php echo $row['tax_id']; ?></td>
                                <td>
                                    <a href="<?php echo $admin_url . '/customer-edit.php?id=' . $row['id']; ?>" class="btn btn-warning btn-sm">
                                        <i class="bi bi-pencil-square"></i> แก้ไข
                                    </a>
                                    <a href="<?php echo $admin_url . '/customer-delete.php?id=' . $row['id']; ?>" class="btn btn-danger btn-sm" onclick="return confirm('ยืนยันการลบข้อมูลลูกค้านี้?');">
                                        <i class="bi bi-trash"></i> ลบ
                                    </a>
                                </td>
                            </tr>
                        <?php endwhile; ?>
                    <?php else: ?>
                        <tr>
                            <td colspan="7" class="text-center">ไม่พบข้อมูลลูกค้า</td>
                        </tr>
                    <?php endif; ?>
                </tbody>
            </table>
        </div>
    </div>
    <div class="card-footer clearfix">
        <ul class="pagination pagination-sm m-0 float-end">
            <?php for ($i = 1; $i <= $total_pages; $i++): ?>
                <li class="page-item <?php echo $i == $page ? 'active' : ''; ?>">
                    <a class="page-link" href="?page=<?php echo $i; ?>&search_keyword=<?php echo $search_keyword; ?>"><?php echo $i; ?></a>
                </li>
            <?php endfor; ?>
        </ul>
    </div>
</div>
<?php
    $content = ob_get_clean();
    $js_script = '';
    include 'template_master.php';
?>

Youez - 2016 - github.com/yon3zu
LinuXploit