<?
	include('check_admin.php');
	require_once('link.php');
	mysql_select_db($database,$connect);
?>

<!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">
<title>管理者-留言列表</title>

<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/bg6.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 {
	font-family: Arial, Helvetica, sans-serif;
	color: #FFFFFF;
}
.style5 {
	font-size: 16px;
	font-weight: bold;
}
--></style>

</head>

<script  language="JavaScript">
function check()
{
	var r=confirm("是否刪除此留言?");
	if(r==true)
		return true;
	if(r==false);
		return false;
	
}
</script>

<body leftmargin=0 topmargin=0 bgproperties="fixed" rightmargin=0  bottommargin=0 marginwidth=0 marginheight=0>
<center>
<p>&nbsp;</p>
<p><a href="admin_link.htm" class="style5">管理者功能列表</a></p>
<?
	$query = "SELECT * FROM `Msg` ORDER BY `mDateTime` DESC";
	mysql_query('SET NAMES utf8');
	$result = mysql_query($query,$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" border="0" cellpadding="1" cellspacing="0" align="center" class="style1">
	<!--<tr>
	  <td colspan="3"><div align="center">留言內容</div></td>
    </tr>-->
	<tr>
		<td width="134" bgcolor="#1F0A23"><div align = "center">發表人</div></td>
		<td></td>
		<td width="148" bgcolor="#1F0A23"><div align = "center"><? echo $row[$index][mId];?></div></td>
	</tr>
	<tr><td colspan = "3"></td></tr>
	<tr>
		<td  height="21" bgcolor="#240B2C"><div align = "center">E-mail</div></td>
		<td width="0"></td>
		<td bgcolor="#240B2C"><div align = "center"><? echo $row[$index][email]; ?></div></td>
	</tr><tr><td colspan = "13"></td>
	<tr>
		<td bgcolor="#523654"><div align = "center">發表日期</div></td>
		<td></td>
		<td bgcolor="#523654"><div align = "center"><? echo $$row[$index][mDateTime];?></div></td>
	</tr>
	<tr><td colspan = "3"></td></tr>
	<tr>
		<td bgcolor="#806269"><div align = "center">標題</div></td>
		<td></td>
		<td bgcolor="#806269"><div align = "center"><? echo $row[$index][mTitle];?></div></td>
	</tr>
	<tr><td colspan = "3"></td></tr>
	<tr bgcolor="#A79085">
		<td colspan = "3"><div align = "center"><? echo $row[$index][mContent];?></div></td>
	</tr>
	<tr><td colspan = "3"></td></tr>
	<tr bgcolor="#624746">
		<td colspan = "3"><div align = "center">
		  <table border = "0">
			<tr>
				<td>
					<form name = "msgadmin1" method = "post" action="dmsg.php" onSubmit = "return check()">
						<div align="center">
						<input type = "hidden" value="<? echo $row[$index][seq];?>" name="seq">
						<input type = "submit" value = "刪除" name="msgdel"></div>
					</form>
				</td>
				<td>
					<form name = "msgadmin2" method = "post" action="mmsg.php">
						<div align="center">
						<input type = "hidden" value="<? echo $row[$index][seq];?>" name="seq">
						<input type = "submit" value = "修改" name="msgmodify"> </div>
					</form>
				</td>
			</tr>
		</table></div>
		</td>
	</tr>
</table>
<p>
<? }?>
<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="admin_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>
</center>
</body>
</html>
