-
Notifications
You must be signed in to change notification settings - Fork 0
/
passRenew.php
44 lines (38 loc) · 1.56 KB
/
passRenew.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
<?php
session_start();
require_once('config.php');
$_SESSION['xsrf'] = md5(rand(10-10000));
?>
<!DOCTYPE html>
<html lang="pl">
<head>
<title>Password change</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
</head>
<body>
<div>
<?php
if(isset($_GET['hash']) && !empty($_GET['hash'])){
$hash = $link->real_escape_string($_GET['hash']);
$search = $link->query("SELECT hash FROM users WHERE hash='$hash'");
if($search->num_rows > 0) {
echo '<form action="passRenewWork.php" method="post">
<input type="text" name="uname" placeholder="Type username" required>
<input type="password" name="pass1" placeholder="Type new password" required>
<input type="password" name="pass2" placeholder="Powtórz nowe hasło" required>
<input type="hidden" name="xsrf" value="'.$_SESSION['xsrf'].'">
<button type="submit" id="submit">Zmień hasło</button>
</form>';
}
else {
echo '<div>Adres URL jest niepoprawny</div>';
}
}
?>
</div>
</body>
<script type="text/javascript">
// type ajax here to passRenewWork.php file with POST method
</script>
</html>