-
Notifications
You must be signed in to change notification settings - Fork 85
/
forgotpass.php
85 lines (80 loc) · 3.06 KB
/
forgotpass.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
<?php
/**
* Online-Job-Portal - A web application built on PHP HTML & javascript
Copyright (C) 2016 Sreelal C
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
session_start();
include_once('config.php'); //connects to the database
if (isset($_POST['email'])){
$email = $_POST['email'];
$query="select * from login where email='$email'";
$result = mysqli_query($db1,$query);
$count=mysqli_num_rows($result);
// If the count is equal to one, we will send message other wise display an error message.
$sentmail=0;
if($count==1)
{
$rows=mysqli_fetch_array($result);
$pass = $rows['password'];//FETCHING PASS
//echo "your pass is ::".($pass)."";
$to = $rows['email'];
//echo "your email is ::".$email;
//Details for send
//ing E-mail
$from = "Job Portal";
$url = "http://www.jobportal.com/";
$body = "Your Password Recovery
-----------------------------------------------
Url : $url;
email Details is : $to;
Here is your password : $pass;
Sincerely,
Coding Cyber";
$from = "[email protected]";
$subject = "JobPortal Password recovered";
$headers1 = "From: $from\n";
$headers1 .= "Content-type: text/html;charset=iso-8859-1\r\n";
$headers1 .= "X-Priority: 1\r\n";
$headers1 .= "X-MSMail-Priority: High\r\n";
$headers1 .= "X-Mailer: Just My Server\r\n";
$sentmail = mail ( $to, $subject, $body, $headers1 );
} else {
if ($_POST ['email'] != "") {
echo '<span style="color: #ff0000;"> Not found your email in our database</span>';
}
}
//If the message is sent successfully, display success message otherwise display an error message.
if($sentmail==1)
{
echo "<span style='color: #ff0000;'> Your Password Has Been Sent To Your Email Address.</span>";
}
else
{
if($_POST['email']!="")
echo "<span style='color: #ff0000;'> Cannot send password to your e-mail address.Problem with sending mail...</span>";
}
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Forgot Password</title>
</head>
<body>
<form action="<?php echo $_SERVER["PHP_SELF"];?>" method="post">
<label> Enter your User ID : </label>
<input id="username" type="text" name="email" />
<input id="button" type="submit" name="button" value="Sent My Password" />
</form>
</body>
</html>