-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathreset.php
More file actions
35 lines (25 loc) · 965 Bytes
/
Copy pathreset.php
File metadata and controls
35 lines (25 loc) · 965 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
28
29
30
31
32
33
34
35
<?php
//Resetting password after verification code is authenticated.
if(isset($_POST["generate"])){
$new_p = $_POST['new_password'];
$Cnew_p = $_POST['Cnew_password'];
$id = $_GET['id'];
if($new_p != $Cnew_p){
$_SESSION['error'] = 'The Password does not match. Please try again';
}
else{
$np = password_hash($new_p, PASSWORD_DEFAULT);
$Csql = "UPDATE voters SET password = '$np' WHERE id = '$id'";
if($conn->query($Csql)){
$_SESSION['success'] = "Password updated successfully. <a href='index.php'>Click here to login.</a>";
// header('location: index.php');
//exit();
}
else{
$_SESSION['error'] = "Sorry, your password failed to update.";
//exit();
}
}
}
header('location: reset_model.php');
?>