This repository has been archived by the owner on Apr 8, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathindex.php
69 lines (63 loc) · 3.49 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
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
<?php
require_once 'conexao.php';
if( (!empty($_POST['cpf'])) and (!empty(md5($_POST['senha'])))) {
$r = $db->prepare("SELECT * FROM pessoa WHERE cpf=? AND senha=? AND inativado=0");
$r->execute(array($_POST['cpf'],md5($_POST['senha'])));
if($r->rowCount()==0) {echo "<div class='alert alert-danger alert-dismissible fade show' role='alert'>Dado(s) incorreto(s) ou inativados!<button type='button' class='btn-close' data-bs-dismiss='alert' aria-label='Close'></button></div>";}
else {
session_start();
$linhas = $r->fetchAll(PDO::FETCH_ASSOC);
foreach($linhas as $l) {
$_SESSION['cpf'] = addslashes($l['cpf']);
$_SESSION['tipo'] = addslashes($l['tipo']);
$_SESSION['nome'] = addslashes($l['nome']);
if($l['tipo']==1) {
$_SESSION['analistaLogado'] = true; header("location: analista/index.php");}
elseif($l['tipo']==2) {
if($l['email']==null) {$_SESSION['clienteLogado'] = true; header("location: cliente/primeiroAcesso.php");}
else {$_SESSION['clienteLogado'] = true; header("location: cliente/index.php");}
}
}
}
}
?>
<!DOCTYPE html>
<html lang="pt-br">
<head>
<title>InvistAí</title>
<meta charset="UTF-8">
<link rel="shortcut icon" href="https://img.icons8.com/fluent/96/000000/bad-idea.png">
<link rel="stylesheet" href="estilo.css">
<link href="https://cdn.jsdelivr.net/npm/[email protected]/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-giJF6kkoqNQ00vy+HMDP7azOuL0xtbfIcaT9wjKHr8RbDVddVHyTfAAsrekwKmP1" crossorigin="anonymous">
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/js/bootstrap.bundle.min.js" integrity="sha384-ygbV9kiqUc6oa4msXn9868pTtWMgiQaeYH7/t7LECLbyPA2x65Kgf80OJFdroafW" crossorigin="anonymous"></script>
<meta name="viewport" content="width=device-width, initial-scale=1">
<script type="text/javascript" src="script.js"></script>
<script type="text/javascript" src="pace.min.js"></script>
</head>
<body id="login">
<div class="container" id="login2">
<div class="container-fluid">
<div class="row">
<div class="col-sm-12 text-center">
<img src="https://img.icons8.com/fluent/96/000000/bad-idea.png"/>
<h1>InvistAí</h1>
<h4 class="text-muted">Software de recomendações de compras de ações</h4>
<form action="index.php" method="post">
<div class="form-floating mb-3">
<input type="text" class="form-control" placeholder="cpf" required name="cpf" pattern="\d{11}" maxlength="11" onkeypress="return isNumber(event)">
<label for="floatingInput">CPF</label>
</div>
<div class="form-floating mb-3">
<input type="password" class="form-control" placeholder="senha" required name="senha" maxlength="5" style="text-transform:lowercase;">
<label for="floatingInput">Senha</label>
</div>
<button id="submitWithEnter" type="submit" class="btn btn-primary btn-lg">Entrar</button>
</form>
<br>
<a href="analista/addAnalista.php" class="btn btn-secondary btn-sm">Novo analista</a>
</div>
</div>
</div>
</div>
</body>
</html>