Location: PHPKode > projects > PhpMyInventory > pmi281/viewUsers.php
<?
  Include("Includes/global.inc.php");
  checkPermissions(1, 1800);

  $strSQL = "SELECT userID, firstName, middleInit, lastName, id, securityLevel, lastLogin 
     FROM tblSecurity WHERE accountID=$accountID ORDER BY lastName";
  $strSQL = determinePageNumber($strSQL);
  $result = dbquery($strSQL);

  writeHeader("View All Users");

  echo "<table border='0' cellpadding='5' cellspacing='0'>";
  echo "<tr class='title'><td>&nbsp;</td><td><b>Name</b></td><td><b>Type</b></td>";
  echo "<td><b>Last Login</b></td><td><b>Action?</b></td></tr>\n";
  $rowCount = 0;
  while ($row = mysql_fetch_array($result)) {
       $rowCount++;

       $strUserID     = $row[0];
       $strFirstName  = $row[1];
       $strMiddleInit = $row[2];
       $strLastName   = $row[3];
       $intUserID     = $row[4];
       $intLevel      = $row[5];
       $strLastLogin  = $row[6];
       If (!$strLastLogin) {
           $strLastLogin = "&nbsp;";
       } Else {
           $strLastLogin = displayDateTime($strLastLogin)." &nbsp;";
       }

       echo "<tr class='".alternateRowColor()."'><td>$rowCount.</td>\n";
       echo "<td>".buildName($strFirstName, $strMiddleInit, $strLastName, 0);
       echo " &nbsp;</td>\n<td>".writeSecurityLevel($intLevel)." &nbsp;</td>\n<td>";
       echo $strLastLogin."</td>\n<td>";

       If (($userID == $intUserID) AND ($sessionSecurity < 2)) {
           echo "<a href='userAccount.php'>Edit</a>&nbsp; \n";
       } ElseIf (($intLevel == 3) OR ($sessionSecurity < 1)) {
           echo "<a href='editUser.php?editID=$intUserID'>Edit</a>&nbsp; \n";
       } Else {
            echo "N/A";
       }
       If (($userID != $intUserID) AND ($sessionSecurity < 1)) {
            echo "<a href='deleteUser.php?editID=$intUserID' onClick=\"return warn_on_submit('You are about to delete a user from the inventory! \\nThis will also delete *all inventory* associated with this user.');\">Delete</a></li>\n";
       }
       echo "</td></tr>\n";
  }

  echo "</table>";
  createPaging();

  writeFooter();
?>
Return current item: PhpMyInventory