-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathforget_password.php
54 lines (48 loc) · 2.27 KB
/
forget_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
<?php require_once('database/connection.php') ?>
<?php include_once('linker.php') ?>
<?php include_once('mail_sending.php') ?>
<!-- <?php include_once('header.php') ?> -->
<a href="index.php" class="btn btn-primary m-auto d-flex justify-content-center text-center">Return to Home</a>
<?php
if (isset($_POST['submit_email'])) {
extract($_POST);
// check if credentials are okay, and email is verified
$sql = "SELECT * FROM author_information WHERE author_email='$email'";
$result = mysqli_query($conn, $sql);
// $verification_code = ;
if (mysqli_num_rows($result) > 0) {
$row = mysqli_fetch_assoc($result);
extract($row);
$receiver = $author_email;
$subject = "Reset Password";
$body = "<p>Click On This Link to Reset Password <a href='http://localhost/jkkniu_conference_php/reset_password.php?key=" . $author_email . "&reset=" . $author_password . "'>Reset Password</a></p>";
// $body = '<p>Click On This Link to Reset Password <a href="reset_password.php?email=">' . $author_password . '</a></p>';
$send_mail = send_mail($receiver, $subject, $body);
echo "<p class='text-success text-bold text-center fs-5 mt-3'>Reset password link has sent to your email address</p>";
// header("location: forget_password.php");
// ob_end_flush();
} else {
echo "<p class='text-danger text-bold text-center fs-5 mt-3'>Email is not Found</p>";
}
}
?>
<div class="container my-5 d-flex justify-content-center">
<div class="col-md-5 col-12">
<div class="card rounded m-auto py-4 px-5 shadow">
<form action="" method="post">
<h3 class="text-center">Reset Password Link</h3>
<div class="mb-3">
<label for="email">Email address</label>
<input type="email" class="form-control" name="email" id="email" placeholder="Enter Email Address" required />
</div>
<div class="">
<button type="submit" class="btn btn-primary" name="submit_email">
Submit
</button>
</div>
</form>
<script src="validate_client_side.js"></script>
</div>
</div>
</div>
<?php include_once('footer.php') ?>