segundo commit para testar
[LogadorPet.git] / excluir_horas.php
blob85519090c7202b05d9d650037a2fae749e57c9fe
1 <?php
2 /* Administrar Usuários (alterar_usu.php)
3 1. Opções de criar, editar e remover usuários do logador.
4 */
5 header ("Pragma: no-cache"); // sempre carregar página (não vai ser armazenada no cache http 1,0
6 header("Cache-Control: no-cache, must-revalidate"); // idem http 1,1
8 require_once("Globals.php");
9 //verifica se o administrador está logado
10 checkCookie();
11 // realiza conexão com o banco de dados
12 conecta();
15 <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
17 <html>
18 <head>
19 <title>Excluir Horas</title>
20 <link rel="stylesheet" type="text/css" href="estilo.css">
21 </head>
22 <body>
25 <?php
26 if(!isset($_GET['id']))
29 <center><h3>Excluir Horas</h2></center>
31 <center>
32 <table border=2 class='bordasimples'>
33 <thead>
34 <th width=100>Nome</th>
35 </thead>
37 <?php
39 $sql = "SELECT login, id_user FROM usuario ORDER BY login ASC";
40 $rs = mysql_query($sql);
42 while($row = mysql_fetch_array($rs))
44 echo "<tr class='tbrow'>";
45 echo "<td><a href='?id=". $row['id_user'] ."'>". $row['login'] ."</a></td>";
46 echo "</tr>";
49 </table>
50 </center>
51 <?php
53 else
55 $sql = "SELECT login FROM usuario WHERE id_user = ". $_GET['id'];
56 $rs = mysql_query($sql);
57 $nome = mysql_result($rs, 0, 'login');
58 echo "<center><h3>Excluir Horas - ". $nome ."</h2></center>";
59 $sql = "SELECT
60 id AS id_hist,
61 id_user,
62 DATE_FORMAT(inicio, '%d/%m/%Y - %Hh %imin') AS inicio,
63 DATE_FORMAT(fim, '%d/%m/%Y - %Hh %imin') AS fim,
64 IF(pendente = 0, '', 'Sim') AS pendente,
65 IF(esq_logado = 0, '', 'Sim') AS esq_logado
66 FROM (historico JOIN config)
67 WHERE
68 id_user = ". $_GET['id'] ."
69 AND
70 (DATE(inicio) >= config.mes_anterior
71 AND DATE(fim) < config.prox_mes)
72 ORDER BY historico.inicio";
73 $pesq_horas = mysql_query($sql) or die(mysql_error());
75 if(mysql_num_rows($pesq_horas) == 0)
77 echo "<center style='color: #ff0000;'>Não há dados!!!</center>";
79 else
81 echo "<table border=2 class='bordasimples' align='center'>\n";
82 echo "<thead>\n";
83 echo "<th>Início</th>\n";
84 echo "<th>Fim</th>\n";
85 echo "<th>Pendente</th>\n";
86 echo "<th>Esqueceu Logado</th>\n";
87 echo "<th>Deletar</th>\n";
88 echo "</thead>\n";
90 while($usuario = mysql_fetch_array($pesq_horas))
92 echo "<form action='exclui_horas.php' method='POST'>";
93 echo "<tr class='tbrow'>\n";
94 echo "<td style='padding:0 20px'>". $usuario['inicio'] ."</td>\n";
95 echo "<td style='padding:0 20px'>". $usuario['fim'] ."</td>\n";
96 echo "<td style='padding:0 20px' align='center'>". $usuario['pendente'] ."</td>\n";
97 echo "<td style='padding:0 20px' align='center'>". $usuario['esq_logado'] ."</td>\n";
98 echo "<td><input type='submit' name='apagar' value='Deletar'></td>\n";
99 echo "</tr>\n\n";
100 echo "<input type='hidden' name='id_hist' value='". $usuario['id_hist'] ."'>";
101 echo "<input type='hidden' name='id_user' value='". $usuario['id_user'] ."'>";
102 echo "</form>";
104 echo "</table>\n";
106 echo "<center><a href='?'><< Voltar para listagem</a></center>";
109 <br>
110 <center>
111 <a href="admin.php"><< Administrador</a><br>
112 <a href="index.php"><< Logador </a><br>
113 </center>
115 </body>
116 </html>