-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchangepass.php
301 lines (269 loc) · 7.26 KB
/
changepass.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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
<?php
session_name(md5("www.r6club.com.br"));
session_start();
if(isset($_SESSION['login_id']) and !empty($_SESSION['login_id'])){
require('connection.php');
$id = $_SESSION['login_id'];
$busca_dados_user = mysqli_query($conexao,"SELECT * FROM users WHERE id = '$id'");
$dados_user = mysqli_fetch_array($busca_dados_user);
//DADOS DO USUÁRIO PARA SEREM UTILIZADOS NA PÁGINA
$nick = $dados_user['nick'];
$email = $dados_user['email'];
$img_perfil = $dados_user['img_perfil'];
$pass_atual_crypt = $dados_user['senha'];
//VERIFICA SE USUÁRIO NÃO ESTÁ BUSCANDO PARTIDA
$busca_searching = mysqli_query($conexao, "SELECT id_user, ativo FROM users_buscando WHERE id_user = '$id' and ativo = '1' and playing = '0'");
$busca_playing = mysqli_query($conexao, "SELECT id_user, ativo FROM users_buscando WHERE id_user = '$id' AND ativo = '1' AND playing = '1' AND id_lobby != '0'");
if(mysqli_num_rows($busca_searching) == 1){
header("Location: buscando");
echo "<script type='text/javascript'>window.location.href='buscando';</script>";
exit();
}
if(mysqli_num_rows($busca_playing) == 1){
header("Location: play");
echo "<script type='text/javascript'>window.location.href='play';</script>";
exit();
}
//LINGUAGEM
if(!isset($_COOKIE['lang'])){
setcookie('lang','br',time()+60*60*24*30);
include("lang_br.php");
}
if(isset($_COOKIE['lang']) and $_COOKIE['lang'] == 'br'){
include("lang_br.php");
}elseif(isset($_COOKIE['lang']) and $_COOKIE['lang'] == 'us'){
include("lang_us.php");
}elseif(isset($_COOKIE['lang']) and $_COOKIE['lang'] == 'es'){
include("lang_es.php");
}
//FIM LINGUAGEM
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Rainbow 6: Club - By Players. For Players.</title>
<?php include("meta.php"); ?>
<link rel="icon" href="favicon.ico"/>
<link rel="stylesheet" href="css/global.css?v=1.0.0"/>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.0.13/css/all.css" integrity="sha384-DNOHZ68U8hZfKXOrtjWvjxusGo9WQnrNx2sqG0tfsghAvtVlRW3tvkXWZh58N9jp" crossorigin="anonymous">
<link rel="stylesheet" href="css/iziModal.min.css"/>
<script type="text/javascript" src="https://code.jquery.com/jquery-3.3.1.min.js"></script>
<script type="text/javascript" src="js/iziModal.min.js"></script>
<noscript>Precisamos de JavaScript para funcionar.</noscript>
<style type="text/css">
/* PASS */
@charset "utf-8";
#modal_gamemode {
background-color:#0F1319;
display:none;
}
#modal_gamemode_content {
padding:30px;
box-sizing: border-box;
}
#gamemode {
width:100%;
padding:15px;
box-sizing: border-box;
background-image: url(../img/bg_gamemode.jpg);
background-size:100%;
background-repeat: no-repeat;
border-radius:5px;
border:2px solid #212e3a;
margin-bottom:15px;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
cursor:pointer;
}
#gamemode h2 {
margin:0;
color:#FFF;
font-weight:300;
font-size:25px;
width:100%;
}
#gamemode h2 small {
font-size:17px;
}
#gamemode i {
color:#FFF;
font-size:18px;
}
#gamemode:hover {
opacity:0.6;
}
#pass {
width:470px;
margin:40px auto 0px auto;
background-color:#131920;
}
#pass h2 {
background-color:#101417;
color:#FFF;
font-family: 'Open Sans Condensed', sans-serif;
font-weight:300;
text-transform: uppercase;
font-size:30px;
padding:10px 10px 10px 20px;
box-sizing: border-box;
margin:0;
}
#pass_content {
width:100%;
padding:20px;
box-sizing: border-box;
}
#pass_content form {
width:400px;
margin:0px auto;
}
#pass_content input {
width:100%;
height:50px;
border:1px solid #0C1116;
border-radius:7px;
background-color:#0B1015;
padding:10px 20px 10px 20px;
color:#abb1b3;
box-sizing:border-box;
font-size:14px;
outline: none;
}
#pass_content input:focus {
border:1px solid #979797;
background-color:#FFF;
color:#000;
}
#pass_content label {
display:block;
margin-bottom:10px;
color:#FFF;
font-weight:500;
font-size:13px;
text-transform: uppercase;
margin-top:10px;
}
#pass_content input[type=submit] {
width:220px;
margin-top:15px;
padding:13px;
float:right;
cursor:pointer;
background-color:#4175C4;
color:#FFF;
font-weight:700;
font-size:17px;
outline:none;
border:0;
border-radius:5px;
}
#msg_success {
width:400px;
background-color:#478f3d;
color:#FFF;
font-size:14px;
margin:20px auto 0 auto;
padding:10px;
box-sizing: border-box;
border-radius: 5px;
border:1px solid #8ac982;
}
#msg_erro {
width:400px;
background-color:#923a3a;
color:#FFF;
font-size:14px;
margin:20px auto 0 auto;
padding:10px;
box-sizing: border-box;
border-radius: 5px;
border:1px solid #c56d6d;
}
</style>
</head>
<body>
<div id="content">
<?php include("menu_require.php"); ?>
<div id="space"></div>
<div id="pass">
<h2><i style="margin-right:5px;" class="fas fa-key"></i> Alterar senha</h2>
<div id="pass_content">
<form method="post" action="">
<label>Senha atual:</label>
<input type="password" name="pass_atual" required/>
<label>Senha nova:</label>
<input type="password" name="pass_new" required/>
<label>Repita a senha nova:</label>
<input type="password" name="repass_new" required/>
<input type="submit" value="ALTERAR SENHA" name="alterar_senha" />
</form>
<?php
if(isset($_POST['alterar_senha'])){
$pass_atual = hash("sha256", $_POST['pass_atual']);
$pass_new = $_POST['pass_new'];
$repass_new = $_POST['repass_new'];
if($pass_new == $repass_new){
if($pass_atual == $pass_atual_crypt){
if(hash("sha256", $pass_new) != $pass_atual_crypt){
if(strlen($pass_new) >= 5 and strlen($pass_new) <= 24){
$muda_senha = mysqli_query($conexao,"UPDATE users SET senha = '".hash("sha256", $pass_new)."' WHERE id = '$id'");
if($muda_senha == true){
$msg = 'success';
}else{
$msg = 'erro';
}
}else{
$msg = 'tamanho_senha';
}
}else{
$msg = 'senha_atual_igual';
}
}else{
$msg = 'senha_atual_incorreta';
}
}else{
$msg = "repass";
}
}
?>
<div style="clear:both;"></div>
<?php
if(isset($msg)){
switch($msg){
case 'success';
echo "<div id='msg_success'>Senha alterada com sucesso.</div>";
break;
case 'erro';
echo "<div id='msg_erro'>Ocorreu um erro ao alterar sua senha.</div>";
break;
case 'tamanho_senha';
echo "<div id='msg_erro'>Senha deve ter entre 5 e 24 caracteres.</div>";
break;
case 'senha_atual_incorreta';
echo "<div id='msg_erro'>Senha atual está incorreta.</div>";
break;
case 'senha_atual_igual';
echo "<div id='msg_erro'>A sua senha atual já é esta.</div>";
break;
case 'repass';
echo "<div id='msg_erro'>Digite novamente a nova senha.</div>";
break;
}
}
?>
<div style="clear:both;"></div>
</div>
</div>
<?php include('gamemode_modal.php'); ?>
<?php include('foot.php'); ?>
</div>
</body>
</html>
<?php
}else{
header("Location: apresentation");
}
?>