<? session_start();
$brcode=$_SESSION['brcode'];
$user=$_SESSION['user'];
 ?>
<style>
body,td{font-family:'arial narrow';letter-spacing:1;}
th{background-color:c1d799}
.mnu{margin-left:5}
</style>

<script>
function subform()
{
 document.getElementById("f1").submit();
}
</script>

<body bgcolor=fcfff1>
<font color=green><h3>List of Users</h3>
<form id='f1' action='active.php' method='post'>
<table border=1 width=100%>
<tr><td align=right> <input type=submit value='Activate' name='act' onClick=subform()>
<input type=submit value='De-activate' name='inact' onClick=subform() >
</td></tr>
</table>

<table border=0  cellspacing=2 cellpadding=5>
<?
include("../opendb.php");
$re1=mysqli_query($db,"select distinct brcode from bruser order by brcode")or die(mysqli_error($db));
while($br_row=mysqli_fetch_row($re1))
{
 print "<tr><td colspan=5><b>".strtoupper($br_row[0])."</td></tr>";
 print "\n<tr bgcolor='c1d799'><td></td><td>User name </td><td>Level</td><td>Type </td> ";
 print "<td>Dept. </td><td>Desig</td><td>Active</td></tr>";
 $re2=mysqli_query($db,"select * from bruser where brcode='$br_row[0]'");
 while($user_row=mysqli_fetch_array($re2))
 {
   print "\n<tr bgcolor='c1d7bf' onMouseOver=bgColor='Pink'; onMouseOut=bgColor='c1d7bf';>";
   print "<td><input type=checkbox name=chk[] value='$user_row[sno]'></td>";
   print "<td>$user_row[1]</td><td align=center>$user_row[2]</td><td>$user_row[3]</td>";
   print "<td>$user_row[4]</td><td>$user_row[5]</td><td align=center>$user_row[active]</td></tr>";
 }
}
?>
</table>
</form>
