-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.php
More file actions
59 lines (54 loc) · 1.93 KB
/
index.php
File metadata and controls
59 lines (54 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
<?php
require_once('includes/phpvortex/DB_MySQL.class.php');
require_once('includes/conn.php');
$db = new DB_MySQL($db_conn);
$db->Connect();
$db->Query("SET NAMES 'utf8'");
$db->Query("SET CHARACTER SET utf8");
session_start();
if (isset($_REQUEST['logout'])) {
if (!empty($_SESSION['user'])) {
$db->Query("INSERT INTO tb_log (ev_id, usu_id) VALUES (2, {$_SESSION['user']['usu_id']})");
}
$_SESSION['user'] = array();
}
if (isset($_REQUEST['user'])) {
$rs = $db->Query("SELECT * FROM tb_usuario WHERE usu_login = '".$db->AddSlashes($_REQUEST['user'])."' AND usu_password = '".md5($_REQUEST['password'])."' AND usu_ativo = 1");
if ($rs->RowCount() == 1) {
$_SESSION['user'] = $rs->Row();
$_SESSION['ip'] = $_SERVER['REMOTE_ADDR'];
$db->Query("UPDATE tb_usuario SET dt_ult_login = CURRENT_TIMESTAMP WHERE usu_id = {$_SESSION['user']['usu_id']}");
$db->Query("INSERT INTO tb_log (ev_id, usu_id) VALUES (1, {$_SESSION['user']['usu_id']})");
header("Location:consulta.php");
exit();
} else {
$erro = "Usuário ou Senha Inválidos";
}
}
?>
<?php
//barra do governo full - largura 100%
#require_once ('http://www.saopaulo.sp.gov.br/barrasp/barrasp_full.htm');
require_once ("includes/cabecalho.php");
?>
<body>
<?php
$idCurrent = "Entrar";
require('includes/menu.php');
?>
<div class="container">
<div class="content">
<img src="img/logo_snaids.gif"></img><br/><br/><br/>
<div class="login">
<form action="index.php" method="post">
<p><label for="user" >Usuário:</label><input class="formLogin" type="text" name="user" /></p>
<p><label for="password">Senha:</label><input class="formLogin" type="password" name="password" /></p>
<p><input type="image" src="img/bt_entra.gif" value="Entrar" /></p>
</form>
<?php if (isset($erro)) echo "<p><font color='#FF0000'>$erro</font></p>"; ?>
</div>
</div>
<?php require('includes/rodape.php');?>
</div>
</body>
</html>