Processing \nFrom:  %s
\nCommand:  "; $command_notification_end_msg = "


\n"; $add_new_report_msg = "\n
Add New Report
DateMessageAction
Example of adding bold, italic, and a link: \n The [b]classic[/b] movie [i]Casablanca[/i] is listed on [url=http://www.imdb.com/]IMDb[/url]. \n

\n"; $current_reports_begin_msg = "\n"; $current_reports_row_msg = "\n"; $current_reports_end_msg = "
Current Reports
IDDateMessageAction
%s  


\n"; $table_missing_msg = "The table 'blog' does not yet exist in the database.

Before continuing, you must have a database named '$db_database' and a database user named '$db_username'.

Click the button below to create the 'blog' table.

\n"; //Make Data Safe (and fix magic quotes if enabled) foreach ($_POST as $Field=>$Value) $_POST[$Field] = htmlspecialchars(stripslashes($Value), ENT_QUOTES); //Date Conversion Function function dateToSortStr ($dateStr) { // "MM/DD/YY" --> YYMMDD (Note: Swap sort[0] and sort[1] to use "DD/MM/YY" format instead) $sort = explode("/", $dateStr); return($sort[2] . str_pad($sort[0], 2, "0", STR_PAD_LEFT) . str_pad($sort[1], 2, "0", STR_PAD_LEFT)); } //////////////////////////////////// ?> ESPBS • Blog Administration Center

ESPBS -- Blog Administration Center

\n" . mysql_error()); break; case "Add": //create a new blog entry echo "ADD "; $q = "INSERT INTO blog (sort, date, message) VALUES ('" . dateToSortStr($_POST['date']) . "', '" . $_POST['date'] . "', '" . $_POST['message'] . "')"; $result=mysql_query($q) or die("$q
\n" . mysql_error()); break; case "Update": //modify an existing blog entry echo "UPDATE "; $q = "UPDATE blog SET " . "sort='" . dateToSortStr($_POST['date']) . "'," . "date='" . $_POST['date'] . "'," . "message='" . $_POST['message'] . "' WHERE id='" . $_POST['id'] . "'"; $result=mysql_query($q) or die("$q
\n" . mysql_error()); break; case "Delete": //remove an old blog entry echo "DELETE "; $q = "DELETE FROM blog WHERE id='" . $_POST['id'] . "'"; $result=mysql_query($q) or die("$q
\n" . mysql_error()); break; default: echo "VIEW "; } echo $command_notification_end_msg; //Display Appropriate Data and Forms if (mysql_num_rows(mysql_query("SHOW TABLES LIKE 'blog'"))) { //table 'blog' exists in db $result=mysql_query("SELECT * FROM blog ORDER BY sort DESC"); //retrieve blog entries mysql_close(); printf($add_new_report_msg, date("n/j/y")); //display form to add a new blog entry echo $current_reports_begin_msg; //start display of existing blog entries while ($row = mysql_fetch_array($result)) printf($current_reports_row_msg, $row["id"], $row["id"], $row["date"], $row["message"]); echo $current_reports_end_msg; //end display of existing blog entries echo "$q
\n"; //display SQL statement used to process action command } else { //table 'blog' does not yet exist in db echo $table_missing_msg; } ?>