<?php require "models/connect.php"; require 'models/do_book_search.php'; //if client is not logged in redirect to login.php if (empty($_SESSION)) { header('Location: login.php'); die; } if (isset($_POST['userQuery'])) { $searchResults = bookSearch($_POST['userQuery']); require 'views/header.php'; require 'views/search_results.php'; require 'views/footer.php'; } else { header("Location: index.php"); die; }
<?php header("Content-Type: application/json", true); require "models/connect.php"; require "models/do_book_search.php"; $books = bookSearch($_POST['q']); echo json_encode($books);
<?php require 'models/connect.php'; require 'models/do_book_search.php'; $title = 'Δήλωση βιβλίου προς ανταλλαγή'; //User has given input string for search $books = false; if (!empty($_GET['search'])) { $books = bookSearch($_GET['search']); } require 'views/header.php'; require 'views/book_add_search/search.php'; require 'views/footer.php'; ?>
<?php header("Content-Type: application/json; charset=utf-8", true); require 'models/connect.php'; require 'models/do_book_search.php'; require 'models/show_book_functions.php'; //User has given input string for search $books = false; $results = []; if (!empty($_GET['query'])) { $books = bookSearch($_GET['query']); } else { $books = getAllBooks(); } $results['empty'] = empty($books); $results['books'] = $books; echo json_encode($results);