-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpasswordlink.php
145 lines (142 loc) · 5.36 KB
/
passwordlink.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
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
<?php
session_start();
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<?php include 'links.php'; ?>
<title>reset password | hrms</title>
<link rel="shortcut icon" href="img/icon.png" type="image/x-icon" />
<link rel="stylesheet" href="css/style.css" />
<link rel="stylesheet" href="css/login.css">
</head>
<body>
<header>
<!-- navbar section begins -->
<nav class="navbar navbar-expand-md">
<div class="container">
<a
href="index.php"
class="navbar-brand text-dark font-weight-bold"
>CustomCastle</a
>
<button
class="navbar-toggler"
type="button"
data-toggle="collapse"
data-target="#collapsenav"
>
<span>
<img
src="img/menuHamburger.svg"
width="35px"
height="35px"
alt="menu-hamberger-icon"
/>
</span>
</button>
<div
class="collapse navbar-collapse text-center"
id="collapsenav"
>
<ul class="navbar-nav ml-auto">
<li class="nav-item">
<a href="index.php" class="nav-link text-dark"
>home</a
>
</li>
<!-- <li class="nav-item">
<a
href="#about_us"
class="nav-link text-dark"
>about us</a
>
</li>
<li class="nav-item">
<a
href="#contact_us"
class="nav-link text-dark"
>contact us</a
>
</li>-->
<li class="nav-item">
<a href="login.php" class="nav-link text-dark"
>login</a
>
</li>
<li class="nav-item signup">
<a
href="register.php"
class="nav-link text-dark"
>register</a
>
</li>
</ul>
</div>
</div>
</nav>
<!-- navbar ends -->
</header>
<!-- login script starts -->
<?php
include 'connection.php';
if($con){
if(isset($_GET['submit'])){
$email = $_GET['email'];
$fetch_query = "select * from usr_login where email = '$email' ";
$result = mysqli_query($con, $fetch_query);
$row_count = mysqli_num_rows($result);
if($row_count){
$res = mysqli_fetch_assoc($result);
$recipent = $res['email'];
$subject = "password recovery link";
$passwordlink = "http://localhost/hrms/updatepassword.php?id="."{$recipent}";
$body = "the recovery link for updating your password is "."{$passwordlink}";
$headers = "From:info.customcastle@gmail.com";
if(mail($recipent,$subject,$body,$headers)){
?>
<script>
alert("password recovery link sent to your email id.");
location.replace("login.php");
</script>
<?php
} else{
?>
<script>
alert("unable to send the recovery link. try again :(");
</script>
<?php
}
} else{
?>
<script>
alert("user not registered!!");
</script>
<?php
}
}
}
?>
<!-- form starts -->
<div class="login-form">
<form action="" method="GET">
<h3>Password Recovery Wizard</h3>
<input
type="email"
name="email"
placeholder="enter registered email"
/><br />
<input
type="submit"
name="submit"
value="send link"
id="login-btn"
/><br />
</form>
</div>
<?php include 'footer.php'; ?>
</body>
</html>