Location: PHPKode > projects > SolBT > sol/lista_usuarios.php
<?php
  include("../sol/sessao.php");
  
  //Conecta ao banco e abre query
  $dados = new dados();
  $dados->get_conexao();
  
  $sql = "SELECT
            u.id_usuario, u.username, u.nome_completo, i.nome, c.nome AS cidade, e.sigla, d.departamento, u.ativo, u.nivel, u.email
          FROM
            usuarios AS u
          INNER JOIN
            instituicao AS i ON (i.id_inst = u.id_instituicao)
          INNER JOIN
            cidades AS c ON (c.id_cidade = u.id_cidade)
          INNER JOIN
            uf AS e ON (e.id_uf = c.id_uf)
          INNER JOIN
            departamentos AS d ON (d.id = u.id_departamento)
          ORDER BY
            u.nivel ASC, u.nome_completo ASC";
            
  $rs = mysql_query($sql);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>SolBT - <?=$sitenome?></title>
    <link rel="StyleSheet" type="text/css" href="../sol/includes/estilos.css" id="estilo" />
    <script language='JavaScript' src='../sol/includes/FuncoesTela.js' type="text/javascript"></script>
  </head>
  
  <body>
    <?php
      include("../sol/includes/menus.php");
    ?>
    
    <table width="100%">
      <?php
        include("../sol/includes/top.php");
      ?>
      
      <!-- CONTEUDO DA PAGINA -->
      <tr>
        <td id="Conteudo">
          <br />
          <span class="Titulo">Usu&aacute;rios</span><br />&nbsp;<br />
          <table cellspacing="1" cellpadding="3" style="background-color:#666666;">
            <tr style="color:#FFFFFF; font-weight:bold;">
              <td align="center">ID</td>
              <td>Usu&aacute;rio</td>
              <td>Nome completo</td>
              <td>E-mail</td>
              <td align="center">Departamento</td>
              <td align="center">N&iacute;vel de acesso</td>
              <td align="center">Situa&ccedil;&atilde;o</td>
            </tr>
            <?php
              //Lista os usuarios
              $i = 1;
              
              while ($reg = mysql_fetch_array($rs))
              {
            ?>
            <tr style="background-color:#<? if ($i % 2 == 0) echo "E8E8E8"; else echo "FFFFFF"; ?>;">
              <td align="center"><?=$reg["id_usuario"]?></td>
              <td>
                <?php
                  if (($_SESSION['univel'] == 0) || ($_SESSION['usuario'] == $reg["id_usuario"]))
                  {
                    $linkedicao = 'editar_user.php?id='.$reg["id_usuario"];
                  }
                  else
                  {
                    $linkedicao = '#" onclick="alert(\'Vocẽ só tem permissão para acessar o cadastro do seu próprio usuário!\');';
                  }
                ?>
                <a href="<?=$linkedicao?>"><?=utf8_encode($reg["username"])?></a>
              </td>
              <td><?=utf8_encode($reg["nome_completo"])?></td>
              <td><a href="mailto:<?=utf8_encode($reg["email"])?>" target="_blank"><?=utf8_encode($reg["email"])?></a></td>
              <td align="center"><?=utf8_encode($reg["departamento"])?></td>
              <td align="center"><?=StrUserNivel($reg["nivel"])?></td>
              <td align="center"><? if ($reg["ativo"]) echo "Ativo"; else echo '<span style="color:#FF0000;">Inativo</span>'; ?></td>
            </tr>
            <?php
                $i++;
              }
            ?>
          </table>
          <?php
            if ($_SESSION['univel'] == 0) echo '<br />&nbsp;<br />[ <a href="editar_user.php">Novo usu&aacute;rio</a> ]';
          ?>
          <br />&nbsp;<br />
        </td>
      </tr>
      <!-- FIM DE CONTEUDO DA PAGINA -->
      
      <?php
        include("../sol/includes/rp.php");
      ?>
    </table>
  </body>
</html>
<?php
  @mysql_close();
?>
Return current item: SolBT