-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathadmin_email_recovery.php
80 lines (72 loc) · 2.56 KB
/
admin_email_recovery.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
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
<?php
session_start();
if(isset($_SESSION['FullName'])){
header('location:login_admin.php');
}
include 'connect.php';
$icon = "";
$selectquery = "SELECT * FROM `navbar4`";
$query = mysqli_query($con, $selectquery);
if($query){
$fav_icon = mysqli_fetch_assoc($query);
$icon = $fav_icon['Image'];
}
if(isset($_POST['submit'])){
$email = mysqli_real_escape_string($con, ($_POST['email']));
$checkquery = "SELECT * FROM `admin003` WHERE `Email`='$email' AND `status`='active'";
$query = mysqli_query($con, $checkquery);
$num_rows = mysqli_num_rows($query);
if($num_rows > 0){
$row = mysqli_fetch_assoc($query);
$fname = $row['FirstName'];
$lname = $row['LastName'];
$token = $row['token'];
$subject = "Password Reset";
$body = "Hii, $fname $lname. Click here to reset your password
http://localhost/ShadiKarwao/admin_reset_pass.php?token=$token ";
$sender = "From: shivlalkumarsharma30062003@rjcollege.edu.in";
if(mail($email, $subject, $body, $sender)){ ?>
<script>
alert("Verify your Email...");
location.replace('login_admin.php');
</script>
<?php }
else{ ?>
<script>
alert("something went wrong...");
</script>
<?php }
}
else{ ?>
<script>
alert("Invalid Email...");
</script>
<?php }
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Email Recovery</title>
<link rel="icon" type="image/png" href="images/<?php echo $icon; ?>" />
<link rel="stylesheet" href="sign_up.css">
</head>
<body>
<?php include "dash_navbar.php"; ?>
<section id="container">
<form action="<?php echo htmlentities($_SERVER['PHP_SELF']); ?>" method="post">
<h2>Reset Password</h2>
<div class="input" id="field1">
<label for="email">Email</label>
<input type="email" name="email" id="email" autofocus required>
</div>
<div class="input" id="field6">
<button type="submit" name='submit' id='btn'>Send Email</button>
</div>
<div id="para">Are you admin ? <a href="login_admin.php">Login</a></div>
</form>
</section>
</body>
</html>