<?
	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;
}
.style2 {
	font-size: 16px;
	font-weight: bold;
}
</style>

</head>
<body leftmargin="0" topmargin="0" bgproperties="fixed" rightmargin="0"  bottommargin="0" marginwidth="0" marginheight="0">
<form action = "admin_article.php" method = "post" name = "admin_article">
	<div align="center">
	  <p>&nbsp;</p>
	  <p><a href="admin_link.htm" class="style2">管理者功能列表</a></p>
	  <table width="400" border="0" cellpadding="1" cellspacing="0" class="style1">
		  <tr>
			  <td><div align="center">
	            <input type = "radio" name = "way" value = "all">
			     所有文章
			     <input type = "radio" name = "way" value = "id">
			     帳號
			     <input type = "radio" name = "way" value = "day">
			     日期
			     <input type = "radio" name = "way" value = "band">
			     樂團
            </div></td>
		  </tr>
		  <tr>
			  <td><div align = "center"><input type = "text" name = "condition" size = "15">
			  <input type = "submit" value = "查詢"></div></td>
		  </tr>
	  </table>
  </div>
	</form>
<center>
<br>
  <table width="400" border="0" align="center" cellpadding="1" cellspacing="0" class="style1">
    <?
	switch($way){
	case "all":
	$query1 = "SELECT * FROM `Article`";
	mysql_query('SET NAMES utf8');
	$result1 = mysql_query($query1,$connect);
	$num1 = mysql_num_rows($result1);?>
    <tr bgcolor="#200A23">
      <td colspan = "9"><div align="center"><strong>文章列表</strong>-<? echo "共".$num1."篇<br>";?></div></td>
    </tr>
    <tr>
      <td width="60" height="21" bgcolor="#482A5E"><div align="center"> 帳號 </div></td>
      <td width="0"></td>
      <td width="100" height="21" bgcolor="#482A5E"><div align="center"> 發表時間 </div></td>
      <td width="0"></td>
      <td width="90" height="21" bgcolor="#482A5E"><div align="center"> 樂團 </div></td>
      <td width="0"></td>
      <td width="90" height="21" bgcolor="#482A5E"><div align="center"> 標題 </div></td>
      <td width="0"></td>
      <td width="42" height="21" colspan = "2" bgcolor="#482A5E"><div align="center"> 刪除 </div></td>
    </tr>
    <?
			for($i = 1;$i<=$num1;$i++)
			{
				$row1 = mysql_fetch_object($result1);
	?>
    <tr>
      <td bgcolor="#9C8E9E" ><div align="center"> <? echo $row1->mId;?> </div></td>
      <td width="0"></td>
      <td bgcolor="#9C8E9E" ><div align="center"> <? echo $row1->arDateTime;?> </div></td>
      <td width="0"></td>
      <td bgcolor="#9C8E9E"><div align="center">
          <? if($rcBand1==''){
				echo $row1->rcBand1;
			}
			if($rcBand2==''){
				echo $row1->rcBand2;
			}
		?>
      </div></td>
      <td width="0"></td>
      <td bgcolor="#9C8E9E"><div align="center"> <? echo $row1->title;?> </div></td>
      <td width="0"></td>
      <td bgcolor="#9C8E9E"><form name = "del_check" method = "post" action="del_check.php">
          <div align="right">
            <input type = "hidden" value="<? echo $row1->seq;?>" name="seq">
            <input type = "hidden" value="<? echo $row1->mId;?>" name="mId">
            <input type = "submit" value = "刪除" name="msgdel">
          </div>
      </form></td>
    </tr><tr><td colspan = "10"></td></tr>
    <? 
	}
	break;  //以上全部文章列表
	case "id":
	$query2 = "SELECT * FROM `Article` WHERE `mId` = '$condition'";
	mysql_query('SET NAMES utf8');
	$result2 = mysql_query($query2,$connect);
	$num2 = mysql_num_rows($result2);?>
    <tr bgcolor="#200A23">
      <td colspan = "9"><div align="center"><strong>文章列表</strong>-
              <input type = "hidden" value="<? echo $row1->mId;?>" name="mId">
              <? echo "共".$num2."篇<br>";?></div></td>
    </tr>
    <tr>
      <td height="21" bgcolor="#482A5E"><div align="center"> 帳號 </div></td>
      <td width="0"></td>
      <td height="21" bgcolor="#482A5E"><div align="center"> 發表時間 </div></td>
      <td width="0"></td>
      <td height="21" bgcolor="#482A5E"><div align="center"> 樂團 </div></td>
      <td width="0"></td>
      <td height="21" bgcolor="#482A5E"><div align="center"> 標題 </div></td>
      <td width="0"></td>
      <td colspan = "2" height="21" bgcolor="#482A5E"><div align="center"> 刪除 </div></td>
    </tr>
    <?
			for($i = 1;$i<=$num2;$i++)
			{
				$row2 = mysql_fetch_object($result2);
	?>
    <tr>
      <td bgcolor="#9C8E9E"><div align="center"> <? echo $row2->mId;?> </div></td>
      <td width="0"></td>
      <td bgcolor="#9C8E9E"><div align="center"> <? echo $row2->arDateTime;?> </div></td>
      <td width="0"></td>
      <td bgcolor="#9C8E9E"><div align="center">
          <? if($rcBand1==''){
				echo $row2->rcBand1;
			}
			if($rcBand2==''){
				echo $row2->rcBand2;
			}
		?>
      </div></td>
      <td width="0"></td>
      <td bgcolor="#9C8E9E"><div align="center"> <? echo $row2->title;?> </div></td>
      <td width="0"></td>
      <td bgcolor="#9C8E9E"><form name = "del_check" method = "post" action="del_check.php">
          <div align="right">
            <input type = "hidden" value="<? echo $row2->seq;?>" name="seq">
            <input type = "hidden" value="<? echo $row2->mId;?>" name="mId">
            <input type = "submit" value = "刪除" name="msgdel">
          </div>
      </form></td>
    </tr><tr><td colspan = "10"></td></tr>
    <? 
	}
	break; //以上帳號完
	case "band":
	$query3 = "SELECT * FROM `Article` WHERE `rcBand1` = '$condition' OR `rcBand2` = '$condition'";
	mysql_query('SET NAMES utf8');
	$result3 = mysql_query($query3,$connect);
	$num3 = mysql_num_rows($result3);?>
    <tr bgcolor="#200A23">
      <td colspan = "9"><div align="center"><strong>文章列表</strong>-<? echo "共".$num3."篇<br>";?></div></td>
    </tr>
    <tr>
      <td height="21" bgcolor="#482A5E"><div align="center"> 帳號 </div></td>
      <td width="0"></td>
      <td height="21" bgcolor="#482A5E"><div align="center"> 發表時間 </div></td>
      <td width="0"></td>
      <td height="21" bgcolor="#482A5E"><div align="center"> 樂團 </div></td>
      <td width="0"></td>
      <td height="21" bgcolor="#482A5E"><div align="center"> 標題 </div></td>
      <td width="0"></td>
      <td colspan = "2" height="21" bgcolor="#482A5E"><div align="center"> 刪除 </div></td>
    </tr>
    <?
			for($i = 1;$i<=$num3;$i++)
			{
				$row3 = mysql_fetch_object($result3);
	?>
    <tr>
      <td bgcolor="#9C8E9E"><div align="center"> <? echo $row3->mId;?> </div></td>
      <td width="0"></td>
      <td bgcolor="#9C8E9E"><div align="center"> <? echo $row3->arDateTime;?> </div></td>
      <td width="0"></td>
      <td bgcolor="#9C8E9E"><div align="center">
          <? if($rcBand1==''){
				echo $row3->rcBand1;
			}
			if($rcBand2==''){
				echo $row3->rcBand2;
			}
		?>
      </div></td>
      <td width="0"></td>
      <td bgcolor="#9C8E9E"><div align="center"> <? echo $row3->title;?> </div></td>
      <td width="0"></td>
      <td bgcolor="#9C8E9E"><form name = "del_check" method = "post" action="del_check.php">
          <div align="right">
            <input type = "hidden" value="<? echo $row3->seq;?>" name="seq">
            <input type = "hidden" value="<? echo $row3->mId;?>" name="mId">
            <input type = "submit" value = "刪除" name="msgdel">
          </div>
      </form></td>
    </tr><tr><td colspan = "10"></td></tr>
    <? 
	}
	break; //以上樂團完
	case "day":
	$query4 = "SELECT * FROM `Article` WHERE `arDateTime` LIKE '$condition%'";
	mysql_query('SET NAMES utf8');
	$result4 = mysql_query($query4,$connect);
	$num4 = mysql_num_rows($result4);?>
    <tr bgcolor="#200A23">
      <td colspan = "9"><div align="center"><strong>文章列表</strong>-<? echo "共".$num4."篇<br>";?></div></td>
    </tr>
    <tr>
      <td height="21" bgcolor="#482A5E"><div align="center"> 帳號 </div></td>
      <td width="0"></td>
      <td height="21" bgcolor="#482A5E"><div align="center"> 發表時間 </div></td>
      <td width="0"></td>
      <td height="21" bgcolor="#482A5E"><div align="center"> 樂團 </div></td>
      <td width="0"></td>
      <td height="21" bgcolor="#482A5E"><div align="center"> 標題 </div></td>
      <td width="0"></td>
      <td colspan = "2" height="21" bgcolor="#482A5E"><div align="center"> 刪除 </div></td>
  > </tr>
    <?
			for($i = 1;$i<=$num4;$i++)
			{
				$row4 = mysql_fetch_object($result4);
	?>
    <tr>
      <td bgcolor="#9C8E9E"><div align="center"> <? echo $row4->mId;?> </div></td>
      <td width="0"></td>
      <td bgcolor="#9C8E9E"><div align="center"> <? echo $row4->arDateTime;?> </div></td>
      <td width="0"></td>
      <td bgcolor="#9C8E9E"><div align="center">
          <? if($rcBand1==''){
				echo $row4->rcBand1;
			}
			if($rcBand2==''){
				echo $row4->rcBand2;
			}
		?>
      </div></td>
      <td width="0"></td>
      <td bgcolor="#9C8E9E"><div align="center"> <? echo $row4->title;?> </div></td>
      <td width="0"></td>
      <td bgcolor="#9C8E9E"><form name = "del_check" method = "post" action="del_check.php">
          <div align="right">
            <input type = "hidden" value="<? echo $row4->seq;?>" name="seq">
            <input type = "hidden" value="<? echo $row4->mId;?>" name="mId">
            <input type = "submit" value = "刪除" name="msgdel">
          </div>
      </form></td>
    </tr><tr><td colspan = "10"></td></tr>
    <? 
	}
	break; //以上日期完
}
?>
  </table>
  <p>&nbsp;</p>
</center>
</body>
</html>