<?php
include("sessionLogin.php");
include("connect.php");
$user=$_SESSION['client'];

$query=mysql_query("select * from customer where userID='$user'");
$display=mysql_fetch_array($query);
$no=$display['no'];
?>
<html>
<head>
<link rel="stylesheet" type="text/css" href="messageFrame.css" />
</head>
<body>
<?php
	$per_page=7;

	$query1=mysql_query("SELECT * from inbox where companyID='$no' and sendBy='admin'");
	$total=ceil(mysql_num_rows($query1)/$per_page);

	$page =(isset($_GET['page'])) ? (int) $_GET['page'] :1;
	$start=($page-1)*$per_page;	
	?>
<h3>Inbox: From shakeitmama</h3>
<table width=100% border=0 cellpadding=5>
<tr>
	<td class="head">
		<input type="button" value="Select All" />
		<input type="button" value="Deselect All" />
		<input type="button" value="Delete" />
	</td>
	</tr>
</table>
<table>
	<tr>
		<td>
		Page =>
		<?php
			while($i<=$total){
			echo "<a href='inboxAll.php?page=$i' align=center>$i</a>&nbsp ";
			$i++;
			}
		?>
		</td>
		</tr>
	</table>
<?php
echo "<p class='flip'>";
	echo "<table width=610 border=0 cellpadding=0 cellspacing=0>";
	echo "<tr>";
	echo "<td width=55></td>";
	echo "<td width=55></td>";
	echo "<td width=150><b>From</b></td>";
	echo "<td width=200><b>Title</b></td>";
	echo "<td width=150><b>Time</b></td>";
	echo "</tr>";
	echo "</table>";
	echo "</p>";


$query2=mysql_query("select * from inbox where companyID='$no' and sendBy='admin'");
while($display2=mysql_fetch_array($query2)){
	
	$inboxID = $display2['inboxID'];
	$date = $display2['date'];
	$time = $display2['time'];
	$sendBy = $display2['sendBy'];
	$title = $display2['title'];
	$status = $display2['status'];
	
	if($status=="unread"){
		$icon = "mail.png";
	}else if($status=="read"){
		$icon = "mailOpen.png";
	}
	
	echo "<a href='inboxView.php?id=$inboxID'>";
	echo "<p class='flip2'>";
	echo "<table width=610 border=0 cellpadding=0 cellspacing=0>";
	echo "<tr>";
	echo "<td width=55><input type='checkbox' name='inbox[]' /></td>";
	echo "<td width=55><img src='icon/mail.png' width=23 height=20 /></td>";
	echo "<td width=150>$sendBy</td>";
	echo "<td width=200>$title</td>";
	echo "<td width=150>$date</td>";
	echo "</tr>";
	echo "</table>";
	echo "</p>";
	echo "</a>";

}




?>






</body>
</html>