Exemplo n.º 1
0
$filename = '../data/data.xml';
$mygbXML = new gbXML($data_type, $record_delim, $filename);
//Check that the id we are trying to edit actually exists
$tag_name = 'id';
$tag_value = $_GET['id'];
if (!$mygbXML->tag_and_value_exist($tag_name, $tag_value)) {
    echo <<<HTML
    <p class="error">The id supplied does not exist in the guest book. Please try again.</p>
    <p><a href="javascript: history.go(-1);">Go back</a></p>

HTML;
    include '../includes/admin_footer.php';
    exit;
}
//go to the guestbook and get the ID requested to edit
if (!($recordArray = $mygbXML->get_record_from_file($_GET['id']))) {
    echo <<<HTML
    <p class="error">An unknown error occured. The record could not be read from the data file.</p>
    <p><a href="javascript: history.go(-1);">Go Back</a></p>

HTML;
    include '../includes/admin_footer.php';
    exit;
} else {
    //get a UBBClass object to decode values
    $myUBB = new UBBCodeN();
    //decode the HTML to UBB and assign the variables to populate our template included below:
    $id_value = $_GET['id'];
    $your_name_value = stripslashes($myUBB->decode($recordArray['name']));
    $your_email_value = stripslashes($myUBB->decode($recordArray['email']));
    $your_message_value = stripslashes(swap_image($myUBB->decode($recordArray['msg'])));