die("disabled for now"); require("$_SERVER[DOCUMENT_ROOT]/lib/header.inc.php"); $currHeader->setPageTitle("Goon Guestbook"); $currBanner->addContent("Goon Guestbook"); $currNavbar->setCustomLinksTitle("Guestbook"); $currNavbar->addCustomLink("/guestbook.php?action=add", "Add Comments"); // add view entries for every person who has a guestbook $query = "SELECT DISTINCT users.id, username FROM users, guestbook WHERE users.id = guestbook.owner ORDER BY users.id ASC"; $result = mysql_query($query); while ($row = mysql_fetch_array($result)) { $currNavbar->addCustomLink("/guestbook.php?action=view&owner=$row[id]","View Guestbook for $row[username]"); } // if the person wants to be added, lets give them a form. if ($_REQUEST["action"] == "add") { if (!$_SESSION["isAnonymous"]) $postername = $_SESSION["name"]; ?>
This will let you add a comment to the guestbook.
Note: HTML will be escaped from comments, so don't bother using it.
} // to actually do an add command elseif ($_REQUEST["action"] == "doAdd") { // not much point in calling auth here really, we're allowing basically everybody to post here if (auth(0, true)) { // make sure people don't stick html in here $comments = htmlspecialchars($_POST["comments"]); $query = "INSERT INTO guestbook(owner, datetimeadded, poster, postername, comments) VALUES($_POST[owner], NOW(), $_SESSION[userid],'$_POST[author]', '$comments')"; $result = mysql_query($query); if ($result) { print("Comment added successfully!
"); } if (!$result) print("We could not add that Comment. Here is the exact error: " . mysql_error() . "
"); } else { print("Sorry, you do not have permission to do that. As usual, you can blame this on a few idiots (or actually, just one from Alberta) ruining it for everybody else.
"); } } // if we're viewing a top or bottom list (which is the default action) elseif ($_REQUEST["action"] == "view") { // if we don't know who we are viewing, then show mine if ($_REQUEST["owner"] < 1) $_REQUEST["owner"] = 1; ?>This is the guestbook. You are encouraged to write any comments about the site in here, say hi, whatever. Have fun!
$query = "SELECT datetimeadded, postername, comments FROM guestbook WHERE owner = $_REQUEST[owner] ORDER BY datetimeadded DESC"; $result = mysql_query($query); while ($row = mysql_fetch_array($result)) { print("$comments
"); print("Odd, you shouldn't be here. Go and view someone's guestbook instead! Use the menu on the right to do it.
} require("$_SERVER[DOCUMENT_ROOT]/lib/footer.inc.php"); ?>