This repository has been archived by the owner on May 31, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathcreate-new-password.php
65 lines (57 loc) · 2.11 KB
/
create-new-password.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
<?php
require 'includes/mysql_connection.php';
require 'includes/config.php';
require 'backend/PasswordReset/CreatePassword.php';
require 'includes/messages.php';
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title><?php echo $WebsiteTitle; ?></title>
<link rel="icon" type="image/png" href="images/favicon-16x16.png" sizes="16x16" />
<link rel="stylesheet" href="css/styleSettings.css">
</head>
<body>
<div class="background">
<div class="back">
<!--Mygtukas atgal-->
<form action="/index">
<input type="submit" value="Back" />
</form>
</div>
<?php
$selector = $_GET["selector"];
$validator = $_GET["validator"];
if(empty($selector) || empty($validator)){
echo "Could not validate your request";
}else{
if(ctype_xdigit($selector) !== false && ctype_xdigit($validator) !== false){
?>
<div class="changebox">
<h3>Change your password</h3>
<form method="POST">
<div class="inputs">
<input type="hidden" name="selector" value="<?php echo $selector; ?>">
<input type="hidden" name="validator" value="<?php echo $validator; ?>">
<input type="password" name="pwd" placeholder="Enter a new password..." required></input>
<input type="password" name="pwd-repeat" placeholder="Repeat new password..." required></input>
<button type="submit" name="reset-password-submit">Reset password</button>
</div>
</form>
<?php
}
}
if(isset($_POST['reset-password-submit']))
{
$userSelector = mysqli_real_escape_string($conn, $_POST['selector']);
$userValidator = mysqli_real_escape_string($conn, $_POST['validator']);
$userPwd = mysqli_real_escape_string($conn, $_POST['pwd']);
$userPwdRepeat = mysqli_real_escape_string($conn, $_POST['pwd-repeat']);
echo CreatePassword($userSelector, $userValidator, $userPwd, $userPwdRepeat);
}
?>
</div>
</div>
</body>
</html>