-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathload_result.php
More file actions
57 lines (48 loc) · 1.61 KB
/
Copy pathload_result.php
File metadata and controls
57 lines (48 loc) · 1.61 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
<?php
// initialize session
ob_start();
session_start();
session_regenerate_id();
// include required file
require_once 'init.php';
// validate session
if (!isset($_SESSION['UserEmail'])) {
exit();
}
if (
!(filter_input(INPUT_POST, 'start', FILTER_VALIDATE_INT) === 0 || filter_input(INPUT_POST, 'start', FILTER_VALIDATE_INT)) ||
!filter_input(INPUT_POST, 'limit', FILTER_VALIDATE_INT) ||
!filter_input(INPUT_POST, 'section', FILTER_SANITIZE_SPECIAL_CHARS)
) {
exit();
}
// get all variable needed
$start = filter_input(INPUT_POST, 'start', FILTER_VALIDATE_INT);
$limit = filter_input(INPUT_POST, 'limit', FILTER_VALIDATE_INT);
$search_txt = filter_input(INPUT_POST, 'section', FILTER_SANITIZE_SPECIAL_CHARS);
$val = array(
"%" . $search_txt . "%",
"%" . $search_txt . "%",
"%" . $search_txt . "%",
$start,
$limit
);
// store the result of select statement in $results var
$results = get_all_data(SELECT_SEARCH_LOAD_ALL, $val);
// check if there is an item match the searched text
if ($results != 0) {
// to print all items
foreach ($results as $output) {
// get all variable
$book_id = $output["book_id"];
$book_img = $output["photo"];
// make delete icon function
$delete_fun = " onclick=\"deletePop('delete_book.php', {'id':'$book_id', 'img':'$book_img'} )\" ";
// initialize var
$author = array(
"name" => $output["author_name"],
"url" => "author_section.php?auth=" . $output["author_id"],
);
book($book_img, $book_id, $output["title"], $output["rating"], $delete_fun, $author);
}
}