<?
	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>
<form action = "change_level.php" method = "post" name = "search_member"><div align="center">
  <div align="center">
  <p>&nbsp;</p>
    <p><a href="admin_link.htm" class="style5">管理者功能列表</a></p>
	</div>
<table width="400" border="0" cellpadding="1" cellspacing="0" class="style1">
		  <tr>
			  <td><input type = "radio" name = "way" value = "all">
			     所有會員列表
			      <input type = "radio" name = "way" value = "one">
			     會員帳號
			      <input type = "text" name = "condition" size = "15">
				  <input type = "submit" value = "查詢"></td>
		  </tr>
		  <tr>
		    <td>(水桶:0 會員:1 管理者:2)</td>
		  </tr>
  
	</table>
  </div>
</form>
<center>
<form action = "change_level_act.php" method = "post" name = "change_level_act.php" onSubmit = "return check()">
	<table width="251" border="0" align="center" cellpadding="1" cellspacing="0" class="style1">
		<?
			switch($way){
				case "one":
				$query1 = "SELECT * FROM `Member` WHERE `mId` = '$condition'";
				$result1 = mysql_query($query1,$connect);
				$num1 = mysql_num_rows($result1);?>
				<tr bgcolor="#2D0842">
					<td colspan = "5"><div align="center"><strong>會員列表</strong>-<? echo "共".$num1."人<br>";?></div></td>
				</tr>
				<tr>
					<td width="64" height="21"  bgcolor="#53376A"><div align="center">選擇</div></td><td width="0"></td>
					<td width="89" height="21" bgcolor="#53376A"><div align="center">帳號</div></td><td width="0"></td>
					<td width="88" height="21" bgcolor="#53376A"><div align="center">權限</div></td>
				</tr>
		<?
				for($i = 1;$i<=$num1;$i++)
				{
					$row1 = mysql_fetch_object($result1);
		?>
		<tr>
			<td height="21"  bgcolor="#8C7A96"><div align="center"><input type = "checkbox" name = "choice[<? $i;?>]" value = "<? echo $row1->mId;?>"></div></td><td width="0"></td>
			<td height="21"  bgcolor="#8C7A96"><div align="center"><? echo $row1->mId;?></div></td><td width="0"></td>
			<td height="21" bgcolor="#8C7A96"><div align="center">
			<select name = "level">
				<? 
					for($j = 0;$j<=2;$j++)
    				{
            			if($j == ($row1->level))
							echo "<option value = '".$j."' selected>".$j."</option>";
						else
							echo "<option value = '".$j."'>".$j."</option>";
    				}
				?>　　
			</select> 
			</div></td>

		</tr>
		<?     }
				echo "<input type = 'submit' value = '修改'>";
				echo "<input type = 'reset' value = '重設'>";;
				break;
				case "all":
				$query2 = "SELECT * FROM `Member`";
				$result2 = mysql_query($query2,$connect);
				$num2 = mysql_num_rows($result2);
				?>
				<tr bgcolor="#2D0842">
					<td colspan = "5"><div align="center"><strong>會員列表</strong>-<? echo "共".$num2."人<br>";?></div></td>
				</tr>
				<tr>
					<td width="64" height="21" bgcolor="#53376A"><div align="center">選擇</div></td><td width="0"></td>
					<td width="89" height="21" bgcolor="#53376A"><div align="center">帳號</div></td><td width="0"></td>
					<td width="88" height="21" bgcolor="#53376A"><div align="center">權限</div></td>
				</tr><tr><td colspan = "13"></td></tr
		><?
				for($i = 1;$i<=$num2;$i++)
				{
					$row2 = mysql_fetch_object($result2);
		?>
		<tr>
			<td height="21"  bgcolor="#8C7A96"><div align="center"><input type = "checkbox" name = "choice[<? $i;?>]" value = "<? echo $row2->mId;?>"></div></td><td width="0"></td>
			<td height="21" bgcolor="#8C7A96"><div align="center"><? echo $row2->mId;?></div></td><td width="0"></td>
			<td height="21" bgcolor="#8C7A96"><div align="center">
			<select name = "level">
				<? 
					for($j = 0;$j<=2;$j++)
    				{
            			if($j == ($row2->level))
							echo "<option value = '".$j."' selected>".$j."</option>";
						else
							echo "<option value = '".$j."'>".$j."</option>";
    				}
				?>　
			</select>
			</div></td>
		</tr><tr><td colspan = "13"></td></tr
		><? } 
		echo "<input type = 'submit' value = '修改'>";
		echo "<input type = 'reset' value = '重設'>"; break; }?>
	</table>
	<!--<input type = "submit" value = "刪除">
	<input type = "reset" value = "全部取消">-->
</form>
</center>
</body>
</html>
