Location: PHPKode > projects > OpenBlog mini > OpenBlog mini 1.0/view.php
<?php
	session_start();

	if ($_SESSION['logged_in'] = 'YES') {

		include 'config.php';

		echo $html_header;
		
		// This page allows the Administrator to modify/create/delete posts
		$post_id = $_POST['post_id'];

		if (!empty($post_id)) {
			$mysql_post_data = "SELECT * FROM " . $mysql_post_table . " WHERE " . $mysql_post_id . " = '" . $post_id . "'"; 
			$mysql_post_data_info = mysql_query($mysql_post_data) or die(mysql_error());

			while($mysql_post_data_info_details = mysql_fetch_array($mysql_post_data_info)){
				$post_title = $mysql_post_data_info_details[$mysql_post_title];
				$post_body = $mysql_post_data_info_details[$mysql_post_body];
				$post_date = $mysql_post_data_info_details[$mysql_post_date];
				$post_tags = $mysql_post_data_info_details[$mysql_post_tags];	
			}
			$delete_option = "<br><br><hr><br><form method='post' action='delete.php' style='display: inline; margin: 0;'><b>Delete This Post?</b> (Are you sure?) <select name='id_delete_confirm'><option value='NO' selected>NO</option><option value='YES'>YES</option></select><input type='hidden' name='id_delete' value='" . $post_id . "'> <input type='submit' value='Delete Post'></form>";
			$type = "Modify";
		}
		else { $type = "Create"; }
		
		if (empty($post_date)) { $post_date = date("Y-m-d"); }

		// This section displays a form used to create/modify posts
		echo "<form method='post' action='write.php' style='display: inline; margin: 0;'><b>Title:</b><br> <input type='text' name='post_title' size='86' value='" . $post_title . "'><br><br><b>Body:</b><br><i>Links: ##LINK##http://www.google.com##LINKNAME##Google.com##ENDLINK##<br>Images: ##IMAGE##post.png##ENDIMAGE##<br>YouTube: ##YOUTUBE##123456790##ENDYOUTUBE##</i><br> <textarea cols='65' rows='15' name='post_body'>" . $post_body . "</textarea><br><br><b>Date:</b><br> <input type='text' name='post_date' size='10' value='" . $post_date . "'><br><br><b>Tags (Separate with spaces):<br></b> <input type='text' name='post_tags' size='86' value='" . $post_tags . "'><input type='hidden' name='post_id' value='" . $post_id . "'>";
		if (empty($post_id)) { echo "<input type='hidden' name='status' value='NEW'>"; }
		echo "<br><br><input type='submit' value='" . $type . " Post'></form>" . $delete_option;
		
		echo $html_footer;
		
	}
	else { echo "Error: You are not logged-in/allowed to view this page."; }

?>
Return current item: OpenBlog mini