<?php
session_start();

include "../functions.php";
checkAdmin(session_id());

include "header.php";

$query = "select typeid, typename, typedescrip from movetype where typeid <> 0 order by typename";
$result = mysql_query($query) or die (mysql_error());
?>

<center>
<table width=80% cellspacing=1 cellpadding=3>
<?php
if (mysql_num_rows($result) < 1)
{
	echo "<tr><td>currently no type defind, please <a href=\"addtype.php\">add one</a></td></tr>";
}
else
{
	echo "<tr bgcolor=\"#a0a0a0\"><th>Type</th><th>Description</th><th colspan=2>Options</th></tr>";
	
	$trigger = 1;
	
	while ($row = mysql_fetch_array($result))
	{
		$typeid = $row[0];
		$typename = $row[1];
		$typedescrip = $row[2];
		
		$trigger = ($trigger + 1) % 2;
		
		if ($trigger)
		{
			echo "<tr bgcolor=\"c9c9c9\">";
		}
		else
		{
			echo "<tr bgcolor=\"e9e9e9\">";
		}
		echo "<td>$typename</td>";
		echo "<td>$typedescrip</td>";
		echo "<td align=\"right\"><form action=\"modtype.php\" method=\"post\"><input type=\"hidden\" name=\"typeid\" value=\"$typeid\"><input type=\"submit\" value=\"Modify\"></td></form>";
		echo "<td><form action=\"deltype.php\" method=\"post\"><input type=\"hidden\" name=\"typeid\" value=\"$typeid\"><input type=\"submit\" value=\"Delete\"></td></form>";
	}
}
?>

</table>
</center>
<?php
include "footer.php";
?>