\n"; echo "

$sitename - Editing entry

\n"; echo "All changes have been saved!

\n"; echo "You'll be taken back to the page you came from.
\n"; echo "Alternatively, you can click here if you can't wait.\n"; echo "\n"; } else if(mysql_affected_rows($link_id) == 0) { redirectheader("./index.php?page={$_POST['page']}"); echo "
\n"; echo "

$sitename - Editing entry

\n"; echo "You've made no changes!

\n"; echo "You'll be taken back to the page you came from.
\n"; echo "Alternatively, you can click here if you can't wait.\n"; echo "
\n"; } else { pageheader("$sitename - Error"); echo "
\n"; echo "

Error

\n"; echo "An error has occurred! Entry NOT updated!\n"; echo "
$query
\n"; echo "Back to Guestbook\n"; echo "
\n"; } } else if(isset($_POST['action']) && $_POST['action']=="Delete entry") // DELETE ENTRY: process confirmation of deletion { $link_id=db_connect(); $entryid=$_POST['entryid']; $query="DELETE FROM $posts_table WHERE entryid=$entryid"; $result=mysql_query($query); if(mysql_affected_rows($link_id) == 1) { redirectheader("./index.php?page={$_POST['page']}"); echo "
\n"; echo "

$sitename - Deleting entry

\n"; echo "Entry deleted!

\n"; echo "You'll be taken back to the page you came from.
\n"; echo "Alternatively, you can click here if you can't wait.\n"; echo "
\n"; } else { pageheader("$sitename - Error"); echo "
\n"; echo "

Error

\n"; echo "An error has occurred! Entry NOT deleted!"; echo "
\n"; echo "Back to Guestbook\n"; echo "
\n"; } } else // Default action: display form for editing/deleting entry { db_connect(); $entryid=$_GET['entryid']; $query="SELECT username,useremail,homepage,subject,message,date_format(postdate,'%D %b %Y, %r') AS date,postdate, reply FROM $posts_table WHERE entryid=$entryid"; $result=mysql_query($query); // retrieve selected entry from db pageheader("$sitename - Editing entry"); echo "

Editing guestbook entry

"; if($entry=mysql_fetch_array($result)) // entry exists // display entry and ask for confirmation { ?>
Entry dated:
Subject:
Message:
Email address:
Homepage: http://
Posted by:
Reply to guestbook entry:
Selected entry does not exist or cannot be retrieved.\n"; echo "

\n"; echo "\n"; } } } else // user is NOT logged in as administrator\ { not_logged_error(); } pagefooter(); ?>