-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrecuperar.php
186 lines (147 loc) · 5.08 KB
/
recuperar.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
<?php
session_start();
error_reporting(0);
include_once('./css/index.php');
if(isset($_SESSION['User']))
{
echo "<script>window.location='cuenta.php';</script>";
}
?>
<?php
require("./conectados/samp_query.php");
try
{
$rQuery = new QueryServer( $serverIP2, $serverPort );
$aInformation = $rQuery->GetInfo( );
$aServerRules = $rQuery->GetRules( );
$aBasicPlayer = $rQuery->GetPlayers( );
$aTotalPlayers = $rQuery->GetDetailedPlayers( );
$rQuery->Close( );
}
catch (QueryServerException $pError)
{
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<!-- Anuncio -->
<script async src="//pagead2.googlesyndication.com/pagead/js/adsbygoogle.js"></script>
<script>
(adsbygoogle = window.adsbygoogle || []).push({
google_ad_client: "ca-pub-1072011961085613",
enable_page_level_ads: true
});
</script>
<!-- Anuncio -->
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
<title><?php echo $NombreServidor?> Roleplay - Restablecer contraseña</title>
<link rel="stylesheet" type="text/css" href="css/estilos3.css"/>
<link rel="shortcut icon" href="./imagenes/favicon/favicon.ico" />
<link rel="stylesheet" href="./css/style.css"/>
</head>
<body>
<table width="997" border="0" cellpadding="0" cellspacing="0" bgcolor="#E4E4E4" align="center">
<?php
function validarCadena($cadena)
{
$permitidos = "abcdefghijklmnopqrstuvwxyzñABCDEFGHIJKLMNOPQRSTUVWXYZÑ0123456789";
for ($i=0; $i<strlen($cadena); $i++)
{
if (strpos($permitidos, substr($cadena,$i,1))===false)
{
return false;
}
}
return true;
}
?>
<tr>
<td width="997">
<?php include("header.php"); ?>
<div id="contenido">
<div id="contenido-izquierdo">
<?php
$token = $_GET['tkp'];
$idusuario = $_GET['oz'];
$aldp = $con->prepare("SELECT * FROM recuperarclave WHERE token = :token");
$aldp->bindParam(':token', $token, PDO::PARAM_STR);
$aldp->execute();
$num_rows = $aldp->rowCount();
if($num_rows == 1)
{
$usuario = $aldp->fetch(PDO::FETCH_ASSOC);
$hahn = $usuario['username'];
if( sha1($usuario['idusuario']) == $idusuario )
{
?>
<section class="elcontenedor">
<div class="login">
<h1><?php echo $Texto_Index_269;?></h1>
<form method="post">
<p><input type="password" name="nuevaclave" value="" placeholder="<?php echo $Texto_Index_270;?>."></p>
<p><input type="password" name="nuevaclave2" value="" placeholder="<?php echo $Texto_Index_271;?>."></p>
<p><input type="submit" name="submit" value="<?php echo $Texto_Index_272;?>"></p>
</form>
</div>
</section>
<?php
}
else
{
echo "<script>window.location='index.php';</script>";
}
}
else
{
echo "<script>window.location='index.php';</script>";
}
?>
<?php
$submit = $_POST['submit'];
$contranueva = $_POST['nuevaclave'];
$contranueva2 = $_POST['nuevaclave2'];
if($submit)
{
if($contranueva || $contranueva2)
{
if($contranueva == $contranueva2)
{
if(validarCadena($contranueva) == true && validarCadena($contranueva2) == true)
{
$stmt = $con->prepare("UPDATE usuarios SET Password = :password WHERE Username = :usuario");
$stmt->bindParam(':password', md5($contranueva), PDO::PARAM_STR);
$stmt->bindParam(':usuario', $hahn, PDO::PARAM_STR);
$stmt->execute();
$stm2 = $con2->prepare("UPDATE smf_members SET passwd=SHA1(CONCAT(LOWER(:usuario), :password)) WHERE member_name = :usuario");
$stm2->bindParam(':password', $contranueva, PDO::PARAM_STR);
$stm2->bindParam(':usuario', $hahn, PDO::PARAM_STR);
$stm2->execute();
$stm3 = $con->prepare("DELETE FROM recuperarclave WHERE token = :token");
$stm3->bindParam(':token', $token, PDO::PARAM_STR);
$stm3->execute();
echo '<div class="login" style="padding:5px;top:20px;background-color:#06AD00; color:#FFFFFF; width:560px; text-align:center;"><strong>Cambio realizado correctamente.</strong></div>';
session_destroy();
}
else
{
echo '<div class="login" style="padding:5px;top:20px;background-color:#F00; color:#FFFFFF; width:560px; text-align:center;"><strong>No puedes usar caracteres invalidos en la contraseña.</strong></div>';
}
}
else
{
echo '<div class="login" style="padding:5px;top:20px;background-color:#F00; color:#FFFFFF; width:560px; text-align:center;"><strong>Las contraseñas no son iguales.</strong></div>';
}
}
else
{
echo '<div class="login" style="padding:5px;top:20px;background-color:#F00; color:#FFFFFF; width:560px; text-align:center;"><strong>Te faltaron ingresar los datos.</strong></div>';
}
}
?>
</div>
<div id="menu-derecho">
<style>.rounded-img{display:inline-block;overflow:hidden;-webkit-border-radius:10px;-moz-border-radius:10px;border-radius:10px;-webkit-box-shadow:0 1px 3px rgba(0,0,0,.9);-moz-box-shadow:0 1px 3px rgba(0,0,0,.9);box-shadow:0 1px 3px rgba(0,0,0,.9);}</style>
<?php include "menu.php" ?>
</div>
<?php include "pie.php" ?>