<?php
Include_once('includes/session_config.php');
//HORIZONTAL MENU
echo"
<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
<tr>
</td><td height=\"50\" valign=\"top\" width=\"150\">
<form name=\"creditac\" method=\"post\" action=\"$PHP_SELF?\">
<input type=\"hidden\" name=\"viewac\" value=\"viewac\">
<input type=\"hidden\" name=\"submit\" value=\"submit\">
<input type=\"hidden\" name=\"name\" value=\"{$_SESSION['name']}\">
<input type=\"hidden\" name=\"id\" value=\"{$_SESSION['id']}\">
<input type=\"hidden\" name=\"user_name\" value=\"{$_SESSION['user_name']}\">
<input type=\"hidden\" name=\"pass\" value=\"{$_SESSION['pass']}\">
<input type=\"image\" img src=\"../images/viewac.jpg\" width=\"92\" height=\"12\" border=\"0\">
</form>
</td><td height=\"50\" valign=\"top\">
<form name=\"messaging\" method=\"post\" action=\"$PHP_SELF?\">
<input type=\"hidden\" name=\"messaging\" value=\"messaging\">
<input type=\"hidden\" name=\"submit\" value=\"submit\">
<input type=\"hidden\" name=\"name\" value=\"{$_SESSION['name']}\">
<input type=\"hidden\" name=\"id\" value=\"{$_SESSION['id']}\">
<input type=\"hidden\" name=\"user_name\" value=\"{$_SESSION['user_name']}\">
<input type=\"hidden\" name=\"pass\" value=\"{$_SESSION['pass']}\">
<input type=\"image\" img src=\"../images/messaging.jpg\" width=\"73\" height=\"14\" border=\"0\">
</form>
</td></tr>
<tr><td colspan=\"2\">
";
//VIEW ACCOUNT
if (isset($_POST['viewac']))
{
$user_name=($_POST['user_name']);
echo "<table width=\"100%\" border=\"0\" cellpadding=\"0\" cellspacing=\"0\">
<tr><td colspan=\"5\" height=\"50\"><h2>View Account</h2></td></tr>";
$query= "SELECT *,DATE_FORMAT(date, '%D %M, %Y') AS date from $user_name ORDER by TIME DESC";
$result=mysql_query($query);
$number=mysql_num_rows($result);
if ($number == 0)
{
echo "<tr><td colspan=\"5\">There are currently no entries in your account.</td></tr>";
}
else
{
//Get account details
echo"<tr><td height=\"50\"><h3>Date</h3></td><td><h3>Type</h3></td><td><h3>Details</h3></td><td><h3>Amount</h3></td><td><h3>Balance</h3></td></tr>";
while ($row=mysql_fetch_array($result))
{
echo "<tr><td height=\"30\">{$row['date']}</td><td>{$row['type']}</td><td>{$row['details']}</td><td>£{$row['amount']}</td><td>£{$row['balance']}</td></tr>";
}
}
echo"</table>";
}
else
{
//MESSAGING
if (isset($_POST['messaging']))
{
include_once ('messaging.php');
}
else
{
echo "<h3>Welcome $name!</h3><br>Please select an option from the menu above.";
}
}
echo"</td></tr></table>";
?>