-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathreset-pass.php
More file actions
50 lines (42 loc) · 1.7 KB
/
Copy pathreset-pass.php
File metadata and controls
50 lines (42 loc) · 1.7 KB
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
<?php
session_start();
$page = "Reset password";
require('conf/variables.php');
require('top.php');
include 'include/avatars.inc.php';
include 'include/genericfunctions.inc.php';
echo '<p class="header">Reset Password</p>';
echo '<p class="text">';
if (!isset($_GET['passkey'])) {
echo "<p>No confirmation key was supplied, please check the link is complete and includes the confirmation key.</p>";
require('bottom.php');
exit;
} else {
$passkey = trim(strip_tags($_GET['passkey']));
// Passkey that got from the link the user got in the verification mail
// Retrieve data from table where row that match this passkey
$sql = "SELECT player_id, passcode FROM $resettable WHERE passcode like '$passkey'";
$result = mysqli_query($db, $sql);
$num_rows = mysqli_num_rows($result);
if ($num_rows == 0) {
echo "<p>Bad confirmation key was supplied, please check the link is complete and includes the confirmation key.</p>";
require('bottom.php');
exit;
} else {
// Change the users password
$row = mysqli_fetch_assoc($result);
$passworddb = uniqid(rand());
echo "<p>Your new password is $passworddb</p>";
echo '<p>Go <a href="/">home and use it</a>!</p>';
// Lets generate the hashed pass...
$passworddb = $salt . $passworddb;
$passworddb = md5($passworddb);
$passworddb = md5($passworddb);
$sql = "UPDATE $playerstable SET passworddb='$passworddb' WHERE player_id = $row[player_id]";
$result = mysqli_query($db, $sql);
$sql = "DELETE FROM $resettable WHERE passcode like '$passkey'";
$result = mysqli_query($db, $sql);
}
}
echo '</p>';
require('bottom.php');