Exemplo n.º 1
0
// Validate browser input ------------------------------------------------------------
$id = isset($_GET['id']) ? $_GET['id'] : FALSE;
$order = isset($_GET['order']) ? $_GET['order'] : FALSE;
$error = FALSE;
if (!is_numeric($id)) {
    $error = TRUE;
    $errorMsg = 'The ID provided is not a number.';
} else {
    if (!$gbXML->tag_and_value_exist('id', $id)) {
        $error = TRUE;
        $errorMsg = 'The ID provided does not match any record in the GuestBook.';
    }
}
//REMOVE THE RECORD FROM THE DATA.XML FILE
//If we fail, set the error flag
if ($gbXML->delete_record_from_file($id) === FALSE) {
    $error = TRUE;
    $errorMsg = 'An unknown error occurred: the guest book record could not be deleted.';
}
if ($error === TRUE) {
    echo <<<HTML
\t<p class="error">{$errorMsg}</p>
    <p><a href="modify.php">Back to Delete Menu</a></p>
    <p>
\t<a href="index.php">Admin Main</a> - <a href="login.php?mode=logout">Logout</a>
    </p>
\t</body>
\t</html>
HTML;
    exit;
}