PageRenderTime 41ms CodeModel.GetById 15ms RepoModel.GetById 1ms app.codeStats 0ms

/exiberelatorioacesso.php

http://conexao.googlecode.com/
PHP | 206 lines | 133 code | 67 blank | 6 comment | 11 complexity | 79925f7f501b286b0073e8842e4e18e2 MD5 | raw file
  1. <? session_start();?>
  2. <html>
  3. <head>
  4. <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
  5. <title>Relat&oacute;rio de Acesso dos Usu&aacute;rios</title>
  6. <link rel="stylesheet" type="text/css" href="css/sysco.css">
  7. </head>
  8. <Script Language="JavaScript">
  9. function getStates(what) {
  10. if (what.selectedIndex != '') {
  11. var estado = what.value;
  12. document.location=('exiberelatorioacesso.php?estado=' + estado);
  13. }
  14. }
  15. </Script>
  16. <body>
  17. <p>
  18. <div align="center" class="td_title">Relat&oacute;rio de Acesso dos Usu&aacute;rios</div>
  19. <?
  20. if(($_SESSION[$perfilusu])=="GERENTE FINANCEIRO") {
  21. include "conecta.php";
  22. $estado=$_GET['estado']; ?>
  23. </p>
  24. <p>Escolha a operacao:
  25. <select name='select' size=1 value='2' onChange='getStates(this);'>
  26. ";
  27. <option value=''>-- SELECIONE ORDENAÇ?O --</option>";
  28. <option value='1' <? if ($estado=='1') {echo "selected='selected'";} ?> > POR DATA </option>
  29. <option value='2' <? if ($estado=='2') {echo "selected='selected'";} ?> > POR USUÁRIO </option>
  30. <option value='3' <? if ($estado=='3') {echo "selected='selected'";} ?> > GERAL </option>
  31. </select>
  32. </p>
  33. <p>
  34. <?
  35. //fazer onclick para atualizar quando for selecionado
  36. switch($estado) {
  37. //------------------------------------------------------
  38. case '01': // ordenado por data
  39. $sql= "SELECT * FROM acesso ORDER BY datacesso";
  40. $resultado=mysql_query($sql) or die ("Nao foi possivel realizar a consulta ao banco de dados".mysql_error());
  41. echo "<table with=740 border=1 cellpading=1 cellspacing=1 align =center valign =top>";
  42. echo "<tr>"; // row --> linha
  43. echo "<th width=100>Código</th>"; // th -> coluna
  44. echo "<th width=100>Usuario </th>";
  45. echo "<th width=100>Data </th>";
  46. echo "<th width=100>Hora </th>";
  47. echo "<th width=50>IP</th>";
  48. echo "</tr>";
  49. while ($linha=mysql_fetch_array($resultado)){
  50. $codigo=$linha["cod_acesso"]; // campo chave de busca
  51. $campo1=$linha["usuario"]; // campo1
  52. $campo2=$linha["datacesso"]; //campo2
  53. $campo3=$linha["hora"]; //campo3
  54. $campo4=$linha["IP"]; //campo4
  55. echo "<tr>"; // row = linha
  56. echo "<th width=15>$codigo&nbsp;</th>"; //nao permitir que o código seja alterado
  57. echo "<th width=100>$campo1&nbsp;</th>";
  58. echo "<th width=100>$campo2&nbsp;</th>";
  59. echo "<th width=100>$campo3&nbsp;</th>";
  60. echo "<th width=50>$campo4&nbsp;</th>";
  61. echo "</tr>";
  62. echo "<br>";
  63. }
  64. echo "</table>";
  65. break;
  66. //------------------------------------------------------
  67. case '02': // ordenado por usuario
  68. $sql= "SELECT * FROM acesso ORDER BY usuario";
  69. $resultado=mysql_query($sql) or die ("Nao foi possivel realizar a consulta ao banco de dados".mysql_error());
  70. echo "<table with=740 border=1 cellpading=1 cellspacing=1";
  71. echo "<tr>"; // row --> linha
  72. echo "<th width=100>Código</th>"; // th -> coluna
  73. echo "<th width=100>Usuario </th>";
  74. echo "<th width=100>Data </th>";
  75. echo "<th width=100>Hora </th>";
  76. echo "<th width=50>IP</th>";
  77. echo "</tr>";
  78. while ($linha=mysql_fetch_array($resultado)){
  79. $codigo=$linha["cod_acesso"]; // campo chave de busca
  80. $campo1=$linha["usuario"]; // campo1
  81. $campo2=$linha["datacesso"]; //campo2
  82. $campo3=$linha["hora"]; //campo3
  83. $campo4=$linha["IP"]; //campo4
  84. echo "<tr>"; // row = linha
  85. echo "<th width=15>$codigo&nbsp;</th>"; //nao permitir que o código seja alterado
  86. echo "<th width=100>$campo1&nbsp;</th>";
  87. echo "<th width=100>$campo2&nbsp;</th>";
  88. echo "<th width=100>$campo3&nbsp;</th>";
  89. echo "<th width=50>$campo4&nbsp;</th>";
  90. // echo "<th width=50><a href='editar.php?opcao=$option&id=$codigo'>Editar</a><br></th>";
  91. echo "</tr>";
  92. echo "<br>";
  93. }
  94. echo "</table>";
  95. break;
  96. //------------------------------------------------------
  97. case '03': // Geral
  98. $sql= "SELECT * FROM acesso";
  99. $resultado=mysql_query($sql) or die ("Nao foi possivel realizar a consulta ao banco de dados".mysql_error());
  100. echo "<table with=740 border=1 cellpading=1 cellspacing=1";
  101. echo "<tr>"; // row --> linha
  102. echo "<th width=100>Código</th>"; // th -> coluna
  103. echo "<th width=100>Usuario </th>";
  104. echo "<th width=100>Data </th>";
  105. echo "<th width=100>Hora </th>";
  106. echo "<th width=50>IP</th>";
  107. echo "</tr>";
  108. while ($linha=mysql_fetch_array($resultado)){
  109. $codigo=$linha["cod_acesso"]; // campo chave de busca
  110. $campo1=$linha["usuario"]; // campo1
  111. $campo2=$linha["datacesso"]; //campo2
  112. $campo3=$linha["hora"]; //campo3
  113. $campo4=$linha["IP"]; //campo4
  114. echo "<tr>"; // row = linha
  115. echo "<th width=15>$codigo&nbsp;</th>"; //nao permitir que o código seja alterado
  116. echo "<th width=100>$campo1&nbsp;</th>";
  117. echo "<th width=100>$campo2&nbsp;</th>";
  118. echo "<th width=100>$campo3&nbsp;</th>";
  119. echo "<th width=50>$campo4&nbsp;</th>";
  120. // echo "<th width=50><a href='editar.php?opcao=$option&id=$codigo'>Editar</a><br></th>";
  121. echo "</tr>";
  122. echo "<br>";
  123. }
  124. echo "</table>";
  125. break;
  126. } //fim do switch case
  127. }else{
  128. if ($_SESSION[$perfilusu]=="") {
  129. echo "<i>Voce precisa estar logado para utilizar esta pagina...</i>";
  130. }else{
  131. if ($_SESSION[$perfilusu]<>"GERENTE FINANCEIRO")
  132. echo "<i>Voce precisa ter o perfil de gerente para utilizar esta pagina...</i>";
  133. }
  134. }
  135. ?>
  136. </p>
  137. <p><a href="/sysco/MenuAdm.php" target="_blank"><div align="center" class="td_title">Voltar</div></a></p>
  138. </body>
  139. </html>