<? 
session_start();
$brcode=$_SESSION['brcode'];
$user=$_SESSION['user']; 
?>

<style>
td{font-family:'arial narrow';letter-spacing:1}
th{background-color:c1d799}
body{font-family:'arial narrow';letter-spacing:1;}
</style>
<?
if(isset($_POST[edit]))
{
$code=$_REQUEST['code'];
 print "<script>window.open('edituser.php?code=$code',menubar=false,resizeable=false); </script>";

}

?>

<body bgcolor=fcfff1>
<font color=green>
<h3>List of active users </h3></font>
<hr bgcolor=red>
<?
include("../opendb.php");
include("../test.php");

$result=mysqli_query($db,"select * from bruser where active='Y' and level<=5 order by brcode ,level desc,username")or die(mysqli_error($db));
?>
<table border=0  cellspacing=2 cellpadding=5>
<th>No.<th>User Name <th>Level <th>Branch <th>Full control <th>Branch Clearing<th>Back dated entries<th> Edit<th>Plantcode
<th>Type 
<?
$i=1;
while($row=mysqli_fetch_array($result))
{
    if($row[2]=='5')
    {
     $fc="YES" ;  
     $bc="FULL ACCESS";
     $be="FULL ACCESS";
     $ed="FULL ACCESS";
    }
    elseif ($row[2]=='4')
    {
      $fc="NO"  ;  
      $bc="7 DAYS";
      $be="7 days";
     $ed="3 days";
    }
    elseif ($row[2]=='3')
    {
      $fc="NO"  ;  
      $bc="7 DAYS";
      $be="7 days";
     $ed="No Edit";  
    }
    else
    {
      $fc="NO"  ;  
      $bc="NO";
      $be="NO";
     $ed="NO";  
    }
    
    $brname=getbrname($row[brcode]);
 print "\n<form action='$PHP_SELF' method='POST'> <input type=hidden name='code' value='$row[sno]'>";
 print "\n<tr bgcolor='c1d7bf' onMouseOver=bgColor='Pink'; onMouseOut=bgColor='c1d7bf'; >".
"<td>".$i++."</td><td>$row[1]</td><td align=center>$row[2]</td><td>$brname</td><td>$fc</td>".
"<td>$bc</td><td>$be</td><td>$ed</td>";
print "<td>$row[brcode]</td><td>$row[utype]</td>";
 print " </tr></form>";
}
?>
</table>
