-
Notifications
You must be signed in to change notification settings - Fork 0
/
validar.php
43 lines (37 loc) · 1.36 KB
/
validar.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
//Verifica-se esta logando
function valida(){
if(!isset ($_SESSION['id']) && !isset($_SESSION['login']) && !isset($_SESSION['nome']) && !isset( $_SESSION['tipo']) ){
echo '<meta http-equiv="refresh" content="0;URL=../login?error=Usuário não logado." />';
}
}
//verifica-se esta logado como administrador
function validaAdmin(){
if($_SESSION["tipo"] != 'admin' ){
echo '<meta http-equiv="refresh" content="0;URL=../home/home.php?error=Usuario inválido." />';
}
}
//verifica-se esta logado como síndico
function validaSind(){
if($_SESSION["tipo"] != 'sind' ){
echo '<meta http-equiv="refresh" content="0;URL=../home/home.php?error=Usuario inválido." />';
}
}
//verifica-se esta logado como administrador e síndico
function validaAdminSind(){
if (!( ($_SESSION["tipo"] == 'sind')||($_SESSION["tipo"] == 'admin') ) ){
echo '<meta http-equiv="refresh" content="0;URL=../home/home.php?error=Usuario inválido." />';
}
}
//verifica-se logado
function logado(){
if(isset ($_SESSION['id']) && isset($_SESSION['login']) && isset( $_SESSION['tipo']) ){
if( ($_SESSION["tipo"] == 'sind')||($_SESSION["tipo"] == 'usuario') ){
echo '<meta http-equiv="refresh" content="0;URL=../home/home.php" />';
}
if($_SESSION["tipo"] == 'admin'){
echo '<meta http-equiv="refresh" content="0;URL=../home/homeAdmin.php" />';
}
}
}
?>