<!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=utf-8">
<style>
.style1 {font-size: 13px; color: #FFFFFF; }
BODY {
	SCROLLBAR-FACE-COLOR: #D4D0C8;
	SCROLLBAR-HIGHLIGHT-COLOR: #D4D0C8;
	SCROLLBAR-SHADOW-COLOR: #999999;
	SCROLLBAR-3DLIGHT-COLOR: #FFFFFF;
	SCROLLBAR-ARROW-COLOR:  #000000;
	SCROLLBAR-TRACK-COLOR: #E3E3E3;
	SCROLLBAR-DARKSHADOW-COLOR: #666666;
	background-color: #000000;
	background-image: url(img/bg3.png);
	background-attachment: fixed;
}
a:link {
	color: white;
	text-decoration: none;
}
a:visited {
	color: white;
	text-decoration: none;
}
a:hover {
	text-decoration: underline;
}
a:active {
	text-decoration: none;
}
body,td,th {
	color: #FFFFFF;
}
.style7 {font-size: 16px}
</style>
</head>

<body leftmargin="0" topmargin="0" bgproperties="fixed" rightmargin="0"  bottommargin="0" marginwidth="0" marginheight="0">
<div align="right">
	<p align="center">&nbsp;</p>
	<p align="center"><a href = "msg.php"><strong>我要留言</strong></a> </p>
</div>

<center>
<?
	require_once('link.php');
	mysql_select_db($database,$connect);
	$str = "SELECT * FROM `Msg` ORDER BY mDateTime DESC";
	mysql_query('SET NAMES utf8');
	$result = mysql_query($str,$connect);
	$num = mysql_num_rows($result);
	for($i=0;$i<=$num;$i++)
	{
		$row[$i] = mysql_fetch_array($result);
	}	
	if (!isset($index))
	{
		$index=0;
	}
	if (isset($page)&&$page>0&&$page<($num+5)/5)
	{
		$index=($page)*5-5;
	}
	$tmp=$index+5;
	$tmp2=$index+5;
	if ($num<$tmp)
	{
		$tmp=$num;
	}
	for (;$index<$tmp;$index++)
	{?>
<table width="286" height="112"  border="0" cellpadding="1" cellspacing="0" class="style1">
	<tr>
		<td width="80"  height="21" bgcolor="#12120C"><div align = "center" class="style7">Name</div></td>
		<td width="0"></td>
		<td width="202" bgcolor="#12120C"><div align = "center" class="style7"><? echo $row[$index][mId]; ?></div></td>
	</tr><tr><td colspan = "13"></td>
	</tr>
	<tr>
		<td  height="21" bgcolor="#474537"><div align = "center" class="style7">E-mail</div></td>
		<td width="0"></td>
		<td bgcolor="#474537"><div align = "center" class="style7"><? echo $row[$index][email]; ?></div></td>
	</tr><tr><td colspan = "13"></td>
	</tr>
	<tr>
		<td  height="21" bgcolor="#7A7862"><div align = "center" class="style7">留言時間</div></td>
		<td width="0"></td>
		<td bgcolor="#7A7862"><div align = "center" class="style7"><? echo $row[$index][mDateTime]; ?></div></td>
	</tr><tr><td colspan = "13"></td>
	</tr>
	<tr>
		<td height="21" bgcolor="#666666"><div align = "center" class="style7">標題</div></td>
		<td width="0"></td>
		<td bgcolor="#666666"><div align = "center" class="style7"><? echo $row[$index][mTitle]; ?></div></td>
	</tr><tr><td colspan = "13"></td>
	</tr>
	<tr>
		<td colspan = "3" bgcolor="#999999"><span class="style7"><? echo $row[$index][mContent];?></span></td>
	</tr>
</table>
<br>
<? }?>
<table width="288"  border="0" cellpadding="1" cellspacing="0" class="style1">
	<tr><td><div align="center">目前在第 <? echo $tmp2/5;?> 頁
	共 <? if($num%5!=0) {echo (int)($num/5)+1;} elseif($num==0) {echo 1;}  else {echo (int)($num/5);}?> 頁</div></td></tr>
	<tr><td><div align="center"><form action="msg_all.php" method="post">
	到第
	<input  name="page" type="text" size="2" maxlength="3" style="BORDER: 1px solid; IME-MODE: disabled">
	頁
	<input type="submit" value="送出" style="color: #FFFFFF; border:1px solid #999999;background-color: #505050;padding-left:2;padding-top:2;padding-right:2">
	</form></div></td></tr>
</table>
		<!--<a href="msg_all1.php?index=<? //echo 0;?>"><font color="#FFFFFF">第一頁</font></a>|<?
		//$tmp=$index-10;
		//if ($index<=5){}
		//elseif ($tmp<=0)
		//{?>
			<a href="msg_all1.php?index=<? //echo 0;?>"><font color="#FFFFFF">上一頁</font></a>|<?
		//}
		//elseif (($tmp%5)>0&&($tmp%5)<5)
		{?>
			<a href="msg_all1.php?index=<? //echo ((int)($tmp/5))*5+5;?>"><font color="#FFFFFF">上一頁</font></a>|<?
		//}
		//else
		//{?>
			<a href="msg_all1.php?index=<? //echo $index-10;?>"><font color="#FFFFFF">上一頁</font></a>|<?
		//}	
		//if ($index<$tmp2||$row[$index]==null){}
		//else
		//{?>
			<a href="msg_all1.php?index=<? //echo $index;?>"><font color="#FFFFFF">下一頁</font></a>|<?
		}
		//if ($num%15!=0) 
		//{?>
			<a href="msg_all1.php?index=<? //echo (int)($num/5)*5;?>"><font color="#FFFFFF">最後一頁</font></a><?
		//}
		//else
		//{?>
			<a href="msg_all1.php?index=<? //echo (int)($num/5)*5-5;?>"><font color="#FFFFFF">最後一頁</font></a><?
		//}?>-->
</center>
</body>
</html>
