<html>
<head>
	<title>Administration</title>
	<link rel="stylesheet" type="text/css" href="http://yui.yahooapis.com/2.9.0/build/reset/reset-min.css" />
	<link rel="stylesheet" type="text/css" href="adminstyle.css" />
</head>
<body>
<h1>Pack 596 Administration - Newsletter</h1>
<?php include("navigation.php"); ?>
<div id="main">
<label for="newTitle">Title:</label><input id="newTitle" type="text" /><br />
<label for="newBody">Body:</label><textarea id="newBody"></textarea><button id="addNew">Add New Post</button>

<?php require_once('DB.inc');
	$db = new DB();
	try {
	$result = $db->select("SELECT * FROM newsletter");
	} catch (Exception $e) {
		echo "Something went wrong " . $e->getMessage() . "<br />\n";
	}
	foreach($result as $post) { ?>
	<div class="post">
	<?=$post['title']?> - <?=date('Y-m-d H:i:s', strtotime($post['dateposted']))?><br />
	<p><?=$post['body']?></p>
	</div>
<?php	}
?>
</div>
</body>
</html>
