-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathchange_password_process.php
More file actions
27 lines (27 loc) · 985 Bytes
/
change_password_process.php
File metadata and controls
27 lines (27 loc) · 985 Bytes
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
<?php
if(isset($_GET['code'])) {
$code = $_GET['code'];
$conn = new mySqli('127.0.0.1', 'root', '', 'giftshopphp');
if($conn->connect_error) {
die('Could not connect to the database');
}
$verifyQuery = $conn->query("SELECT * FROM siteuser WHERE code = '$code' and updated_time >= NOW() - Interval 1 DAY");
if($verifyQuery->num_rows == 0) {
header("Location: login.php");
exit();
}
if(isset($_POST['submit'])) {
$email = $_POST['email'];
$new_password = $_POST['newpassword'];
$changeQuery = $conn->query("UPDATE siteuser SET pwd= '$new_password' WHERE emailid = '$email' and code = '$code' and updated_time >= NOW() - INTERVAL 1 DAY");
if($changeQuery) {
header("Location: success.html");
}
}
$conn->close();
}
else {
header("Location: login.php");
exit();
}
?>