You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 4, 2025. It is now read-only.
dashboard\primary\error("Application not selected");
29
+
die("Application not selected.");
30
+
}
31
+
32
+
if (isset($_POST['draw'])) {
33
+
34
+
// credits to https://makitweb.com/datatables-ajax-pagination-with-search-and-sort-php/
35
+
36
+
$draw = intval($_POST['draw']);
37
+
$row = intval($_POST['start']);
38
+
$rowperpage = intval($_POST['length']); // Rows display per page
39
+
$columnIndex = misc\etc\sanitize($_POST['order'][0]['column']); // Column index
40
+
$columnName = misc\etc\sanitize($_POST['columns'][$columnIndex]['data']); // Column name
41
+
$columnSortOrder = misc\etc\sanitize($_POST['order'][0]['dir']); // asc or desc
42
+
$searchValue = misc\etc\sanitize($_POST['search']['value']); // Search value
43
+
44
+
## Total number of records without filtering
45
+
$sel = misc\mysql\query("SELECT count(1) AS allcount FROM `tokens` WHERE app = ?", [$_SESSION['app']]);
46
+
$records = mysqli_fetch_assoc($sel->result);
47
+
$totalRecords = $records['allcount'];
48
+
49
+
$totalRecordwithFilter = $totalRecords;
50
+
if (!is_null($searchValue)) { // don't double query if no search value was provided
51
+
## Total number of record with filtering
52
+
$sel = misc\mysql\query("SELECT count(1) AS allcount FROM `tokens` WHERE 1 AND (`token` LIKE ? OR `assigned` LIKE ? OR `status` LIKE ? OR `reason` LIKE ? ) AND app = ?", ["%" . $searchValue . "%", "%" . $searchValue . "%", "%" . $searchValue . "%", "%" . $searchValue . "%", $_SESSION['app']]);
53
+
$records = mysqli_fetch_assoc($sel->result);
54
+
$totalRecordwithFilter = $records['allcount'];
55
+
}
56
+
57
+
// whitelist certain column names and sort orders to prevent SQL injection
0 commit comments