<th>--------</th> </tr> <?php $authorId = array(); $booksByAuthor = array(); $collectionId = array(); $bookNotes = ''; if (isset($_GET['author_id'])) { $authorId[] = (int) $_GET['author_id']; } if (isset($_GET['collection_id'])) { $collectionId[] = (int) $_GET['collection_id']; } if (isset($_GET['book_id'])) { $bookDeleteId = (int) $_GET['book_id']; deleteBook($db, $bookDeleteId); } $temp = array(); $booksDisplay = array(); if (empty($collectionId) === true) { $booksDisplay = selectAllBooksByAuthors($db, $authorId, $temp); } else { $booksDisplay = selectAllBooksByCollections($db, $collectionId); } //$booksByAuthor = selectAllBooksByAuthors($db, $authorId, $temp); //$booksByCollection = selectAllBooksByCollections($db, $collectionId); if (!($booksDisplay === false)) { //echo '<pre>'.print_r($booksDisplay, true).'</pre>'; foreach ($booksDisplay as $book => $row) { echo '<tr><td><a href="updateBooks.php?book_id=' . $book . '">' . $row['bookName'] . '</a></td><td>'; $result = array();
<?php if ($_GET) { $id = get("id"); deleteBook($id); } ?> <div class="row"> <div class="col-lg-12"> <h3 class="">Delete Book #<?php echo $id; ?> </h3> <hr/> </div> <!-- /.col-lg-12 --> </div> <div class="row"> <div class="col-lg-12"> <div class="alert alert-success"><strong>Book #<?php echo $id; ?> successfully deleted. </strong></div> <?php go(ADMIN_URL . "?view=books", 2); ?> </div> </div>
} // logout asked if (isset($_GET['signout'])) { signout(); } // new book asked if (isset($_GET['add'])) { addBook(); } // edit book asked if (isset($_GET['edit']) && !empty($_GET['edit'])) { editBook(); } // delete book asked if (isset($_GET['delete']) && !empty($_GET['delete'])) { deleteBook(); } // display writted log asked if (isset($_GET['logs'])) { logsPage(); } // display settings log asked if (isset($_GET['settings'])) { settingsPage(); } // display export page asked if (isset($_GET['export'])) { exportPage(); } // display import page asked if (isset($_GET['import'])) {
<?php require 'controller.php'; $isbn = $_POST['isbn']; $type = $_POST['type']; echo $type; //echo $isbn; if ($type == 'Books') { $members_data = deleteBook($isbn); } else { $members_data = deleteMember($isbn); } //echo $members_data;
header('Content-type: application/json'); include "../php_functions.php"; session_start(); //controllo che l'utente sia loggato come amministratore if (isset($_SESSION["id_user"]) && $_SESSION["id_user"] != 0 && $_SESSION["level"] == 1) { //controllo che l'utente sia loggato come amministratore if (isset($_REQUEST["cmd"])) { $book = array(); $cmd = $_REQUEST["cmd"]; switch ($cmd) { case 'delete_book': $id_book = isset($_REQUEST['id_book']) ? $_REQUEST['id_book'] : ''; //validazione del dato proveniente dal javascript... potrebbe essere modificato dal DOM if (!filter_var($id_book, FILTER_VALIDATE_INT) === false) { //int $book_deleted = deleteBook($id_book); if ($book_deleted == 1) { $book['res'] = true; echo json_encode($book); } else { $book['res'] = false; echo json_encode($book); } } else { //not int $book['res'] = false; echo json_encode($book); } break; default: //ERROR
<?php $index = null; while (!is_numeric($index)) { $index = readline('Enter book ID to delete: '); } $check = deleteBook((int) $index - 1); if (false === $check) { message('Error! Book not deleted.'); } else { message('Book deleted successfully.'); }