-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathindex.php
43 lines (34 loc) · 1.01 KB
/
index.php
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
<?php
error_reporting(0);
date_default_timezone_set("America/Cuiaba");
session_start();
require_once "controllers/config/conexao.php";
if(!empty($_SESSION['auth']['usuario_logado']['id']) && is_numeric($_SESSION['auth']['usuario_logado']['id']) && $_SESSION['auth']['usuario_logado']['id'] != 0){
$con = $cnt->prepare('SELECT u.*,
c.id AS companhia_id,
c.nome AS companhia_nome,
c.descricao AS companhia_desc,
p.nome as posto_desc,
p.id as posto_id
FROM cad_militar u
JOIN cad_cia c ON c.id = u.om_id
JOIN cad_posto p ON p.id = u.posto
WHERE u.id = :usuario_logado
ORDER BY u.id DESC
LIMIT 1;');
$con->bindValue(':usuario_logado', $_SESSION['auth']['usuario_logado']['id'], PDO::PARAM_INT);
$con->execute();
$total = $con->rowCount();
if($total){
$usuario_logado = $con->fetch(PDO::FETCH_ASSOC);
}
if(!$total){
unset($usuario_logado);
}
if($_SERVER['QUERY_STRING']==""){
header("Location: index.php?pasta=home&pagina=inicio");
}
}
require_once "controllers/app.php";
$App = new App();
?>