function delete_entry($id)
{
    $file = open_book_file();
    $item_to_remove = "/" . search_file_for_id($id) . "/";
    for ($x = 0; $x < count($file); $x++) {
        if (preg_match($item_to_remove, $file[$x])) {
            $file[$x] = "";
        }
    }
    rewrite_file($file, "books.txt");
}
Beispiel #2
0
<?php

require "functions.php";
$book = search_file_for_id($_GET['id']);
$item = explode("\t", $book);
delete_entry($_GET['id']);
header("location:biags_library.php?title={$item['1']}&removed=true");