<?php 
/*
This is the default page. It consists of files /header.htm, /mysql_login.php, /displya.php, /login.php, /reset_pass.php, 
/sort.php, and /bottom.htm if session is NOT set.  
*/
/*
Set the session. $admin = 1 differentiate administrator from regular user. 
*/
session_start();
if(isset($_SESSION['autheticate']))
{
	$identification = $_SESSION['identification'];
	$admin = $_SESSION['admin'];
	$placeholder = 1;
}
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>IEEE Student Chater | University of Alaska Acnhorage</title>
<link rel="stylesheet" href="includes/style.css" type="text/css" /></head>
<body> 
<?php
flush();
include("header.htm");
include("includes/mysql_login.php");
/*
Start of div vertical menu
*/
echo "<div class = \" verticalmenu \" >";
/*
If session is set, extract the information for the corresponding user and allow them to edit. 
If user is admin display link to go the administrator's page. If session is not set display 
login textbox. 
*/
if(isset($_SESSION['autheticate']))
{
	$username = "SELECT * FROM `user` where identification = $identification";
	$query_username = mysql_query($username);
	while($query_username_query = mysql_fetch_array($query_username))
	{
		echo "<br><b>Welcome " . $query_username_query[username] . "</b>";
		echo "<br>---------------";
		echo " <br><br> &nbsp;&nbsp;&nbsp; <a href = edit_account.php?userid=$identification>  Edit Account</a><br>"; 
	}
	echo "<br>&nbsp;&nbsp;&nbsp;<a href = post_history.php?userid=$identification&page=1> Posting History </a> <br>";
	echo "<br>&nbsp;&nbsp;&nbsp;<a href = post.php> New Post </a> <br>";
		if($admin == 1)
		{
			echo "<br>&nbsp;&nbsp;&nbsp;&nbsp;<a href=admin/adminform.php>Admin</a> <br> ";
		}
	// Find the name of user
	echo " <br>&nbsp;&nbsp;&nbsp;<a href = includes/logout.php> Logout </a> <br>";
}
else
{
include("includes/login.php");
echo "------------<br>"; 
echo "Forgot your password?<br> ";
echo "<form action=includes/pass_reset.php method=post name=reset>
E-mail: <input name=emailadd  type=text size=12>
<input name=resetpass type=submit value=Reset>
</form> ";
}
/* 
Short the posting by category
*/
echo "<br>--------------<br>";
echo "<b>Sort Postings</b><br> ";
echo "<br>&nbsp;&nbsp;&nbsp;<a href = sort.php?sort=Engineering&page=1>Engineering</a>";
echo "<br><br>&nbsp;&nbsp;&nbsp;<a href = sort.php?sort=Science&page=1>Scinece</a>";
echo "<br><br>&nbsp;&nbsp;<a href = sort.php?sort=Missalenous&page=1> Miscellaneous</a><br>";
echo "--------------<br>";
echo "</div>";
/*
Left Vertical column end
*/
/*Start of div body
*/
echo "<div class = \"indexbody\">";
include("display.php");
echo "</div>";
/*
 End of div body 
 */
include("bottom.htm");

?>
</body>
</html>
