-
Notifications
You must be signed in to change notification settings - Fork 0
/
login.php
executable file
·181 lines (129 loc) · 5.09 KB
/
login.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
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
<?php
require_once('conexao.php');
$senha = '123';
$senha_crip = md5($senha);
//VERIFICAR SE EXISTE UM USUÁRIO ADMINISTRADOR CRIADO NO BANCO
$query = $pdo->query("SELECT * FROM usuario");
$res = $query->fetchAll(PDO::FETCH_ASSOC);
if(@count($res) == 0){
//CRIAR UM USUÁRIO ADMINISTRADOR CASO NÃO EXISTA NENHUM USUÁRIO
$pdo->query("INSERT INTO usuario SET nome = 'Helouise', email = '$email_sistema', senha = '$senha_crip', nivel = 'Administrador'");
}
?>
<!doctype html>
<html lang="pt-br">
<head>
<!-- Required meta tags -->
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400&display=swap" rel="stylesheet">
<link rel="stylesheet" href="fonts/icomoon/style.css">
<link rel="stylesheet" href="css/owl.carousel.min.css">
<!-- Bootstrap CSS -->
<link rel="stylesheet" href="css/bootstrap.min.css">
<!-- Style -->
<link rel="stylesheet" href="css/style.css">
<link rel="shortcut icon" href="images/icologin.ico" type="image/x-icon">
<title>Acesso do Corretor</title>
</head>
<body>
<div class="content">
<div class="container">
<div class="row">
<div class="col-md-6">
<img src="images/undraw_remotely_2j6y.svg" alt="Image" class="img-fluid">
</div>
<div class="col-md-6 contents">
<div class="row justify-content-center">
<div class="col-md-8">
<div class="mb-4">
<h3>Entrar</h3>
<p class="mb-4">Acesso restrito</p>
</div>
<form action="autenticar.php" method="post">
<div class="form-group first">
<label for="username">Usuario (Email)</label>
<input type="text" class="form-control" id="email" name="email">
</div>
<div class="form-group last mb-4">
<label for="password">Senha</label>
<input type="password" class="form-control" id="senha" name="senha" >
</div>
<div class="d-flex mb-5 align-items-center">
<div class="control__indicator"></div>
</label>
<a href="" class="text-danger" data-toggle="modal" data-target="#modalRecuperar">
Recuperar Senha?
</a>
</div>
<input type="submit" value="Acessar" class="btn btn-block btn-primary">
</form>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- Modal Recuperar Senha -->
<div class="modal fade" id="modalRecuperar" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<h5 class="modal-title" id="exampleModalLabel">Recuperar Senha</h5>
<button type="button" class="close" data-dismiss="modal" aria-label="Close">
<span aria-hidden="true">×</span>
</button>
</div>
<form id="form-recuperar">
<div class="modal-body">
<div class="form-group">
<label for="exampleFormControlInput1"><small>E-mail </small></label>
<input type="text" class="form-control" name="recuperar" placeholder="Digite o email no qual foi cadastrado" required>
</div>
<br><small><div align="center" id="mensagem-recuperar"></div></small>
</div>
<div class="modal-footer">
<button type="submit" class="btn btn-primary">Recuperar</button>
</div>
</form>
</div>
</div>
</div>
<script src="//cdnjs.cloudflare.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
<script type="text/javascript">
$("#form-recuperar").submit(function () {
event.preventDefault();
var formData = new FormData(this);
$.ajax({
url: "recuperar.php",
type: 'POST',
data: formData,
success: function (mensagem) {
$('#mensagem-recuperar').text('');
$('#mensagem-recuperar').removeClass()
if (mensagem.trim() == "") {
//$('#btn-fechar-usu').click();
$('#mensagem-recuperar').addClass('text-success')
$('#mensagem-recuperar').text('Senha Enviada para o Email!')
} else {
if(mensagem.trim() == "Não possui cadastro com este email ou cpf digitado!"){
$('#mensagem-recuperar').addClass('text-danger')
$('#mensagem-recuperar').text(mensagem)
}else{
$('#mensagem-recuperar').addClass('text-danger')
$('#mensagem-recuperar').text('Você não está conectado a um servidor SMTP, pode ser que esteja em um servidor local (não é possível disparar e-mail no servidor local) ou o seu servidor de hospedagem está com este serviço desativado, precisa ativá-lo!')
}
}
},
cache: false,
contentType: false,
processData: false,
});
});
</script>
<script src="js/jquery-3.3.1.min.js"></script>
<script src="js/popper.min.js"></script>
<script src="js/bootstrap.min.js"></script>
<script src="js/main.js"></script>
</body>
</html>