-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathforgotPassword.php
91 lines (67 loc) · 2.22 KB
/
forgotPassword.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
<?php
include("header.php");
include("email.php");
if(isset($_POST["submit"])){
$to = $_POST["email"];
$subject = "Password recovery";
$message = "";
$sql="SELECT * FROM `user` WHERE email='$to'";
$result=$con->query($sql);
$sqlF="SELECT * FROM `farmer` WHERE email='$to'";
$resultF=$con->query($sqlF);
if($result->num_rows > 0 || $resultF->num_rows > 0){
if($result->num_rows > 0) {
foreach($result as $row){
$email=$row["email"];
}
}
if($resultF->num_rows > 0) {
foreach($resultF as $row){
$email=$row["email"];
}
}
$_SESSION["code"] = substr(md5(uniqid(rand(),1)),3,10);
//echo($_SESSION["password"]);exit();
$message="your security code is <strong> ".$_SESSION["code"]."</strong><br>"."Please don't share your password with others."."http://localhost/auction/new_password.php?id=".$email;
$confirmMsg="Security code is send to your email.kindly check the mail";
sendmail($to,$subject,$message);
}else{
$confirmMsg="Email is not valid, please enter the registered valid mail.<br>";
}
}
?>
<link href="css/forgotpassword.css" rel="stylesheet" />
<body>
<div class="container" style="margin-top: 100px; margin-bottom: 100px;">
<div>
<?php if(isset($confirmMsg)){ ?>
<div class="alert alert-success" role="alert">
<button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">×</span></button>
<strong>
<?=$confirmMsg?>
</strong>
</div>
<script>
window.setTimeout( function () {
$( ".alert" ).fadeTo( 500, 0 ).slideUp( 500, function () {
$( this ).remove();
} );
}, 8000 );
</script>
<?php
}
?>
</div>
<div class="">
<div class="panel">
<form method="post" action="" enctype="multipart/form-data">
<div class="panel-heading" id="heading"><label>Enter the valid registered email</label></div>
<div class="form-group col-md-4"><input class="form-control" type="email" name="email" placeholder="example@gmail.com" required><br></div>
<div class="panel-body" style="display: contents"><input class="btn btn-success" type="submit" name="submit" value="Send Email"></div>
</form>
<br><br>
</div>
</div>
</div>
</body>
<?php include("footer.php"); ?>