-
Notifications
You must be signed in to change notification settings - Fork 0
/
forgotpasswd.php
36 lines (30 loc) · 1009 Bytes
/
forgotpasswd.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
<?php
if ($_SERVER["REQUEST_METHOD"] == "POST") {
$email = clean_input($_POST["email"]);
$pwd = clean_input($_POST["pwd"]);
$servername = "localhost";
$username = "root";
$password = "";
$dbname = "miniproject";
$conn = mysqli_connect($servername, $username, $password, $dbname);
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
if(isset($_POST['Reset'])) {
$stmt = $conn->prepare("UPDATE customer_details set pwd= ? where email= ?");
$stmt->bind_param("ss", $pwd, $email);
$stmt->execute();
}
else{
echo 'Something went wrong';
}
$conn->close();
header("location: form1.html");
}
function clean_input($data) {
$data = trim($data);
$data = stripslashes($data);
$data = htmlspecialchars($data);
return $data;
}
?>