-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathforgot_pass.php
157 lines (88 loc) · 2.59 KB
/
forgot_pass.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
146
147
148
149
150
151
152
153
154
155
156
157
<?php
session_start();
include("includes/db.php");
include("includes/header.php");
include("functions/functions.php");
include("includes/main.php");
?>
<main>
<!-- HERO -->
<div class="nero">
<div class="nero__heading">
<span class="nero__bold">Forgot</span> password
</div>
<p class="nero__text">
</p>
</div>
</main>
<div id="content" ><!-- content Starts -->
<div class="container" ><!-- container Starts -->
<div class="col-md-12" ><!--- col-md-12 Starts -->
<ul class="breadcrumb" ><!-- breadcrumb Starts -->
<li>
<a href="index.php">Home</a>
</li>
<li>Register</li>
</ul><!-- breadcrumb Ends -->
</div><!--- col-md-12 Ends -->
<div class="col-md-12" ><!-- col-md-12 Starts -->
<div class="box"><!-- box Starts -->
<div class="box-header"><!-- box-header Starts -->
<center>
<h3> Enter Your Email Below , We Will Send You , Your Password </h3>
</center>
</div><!-- box-header Ends -->
<div align="center"><!-- center div Starts -->
<form action="" method="post"><!-- form Starts -->
<input type="text" class="form-control" name="c_email" placeholder="Enter Your Email">
<br>
<input type="submit" name="forgot_pass" class="btn btn-primary" value="Send My Password">
</form><!-- form Ends -->
</div><!-- center div Ends -->
</div><!-- box Ends -->
</div><!-- col-md-12 Ends -->
</div><!-- container Ends -->
</div><!-- content Ends -->
<?php
include("includes/footer.php");
?>
<script src="js/jquery.min.js"> </script>
<script src="js/bootstrap.min.js"></script>
</body>
</html>
<?php
if(isset($_POST['forgot_pass'])){
$c_email = $_POST['c_email'];
$sel_c = "select * from customers where customer_email='$c_email'";
$run_c = mysqli_query($con,$sel_c);
$count_c = mysqli_num_rows($run_c);
$row_c = mysqli_fetch_array($run_c);
$c_name = $row_c['customer_name'];
$c_pass = $row_c['customer_pass'];
if($count_c == 0){
echo "<script> alert('Sorry, We do not have your email') </script>";
exit();
}
else{
$message = "
<h1 align='center'> Your Password Has Been Sent To You </h1>
<h2 align='center'> Dear $c_name </h2>
<h3 align='center'>
Your Password is : <span> <b>$c_pass</b> </span>
</h3>
<h3 align='center'>
<a href='localhost/ecom_store/checkout.php'>
Click Here To Login Your Account
</a>
</h3>
";
$from = "vjhoelas@gmail.com";
$subject = "Your Password";
$headers = "From: $from\r\n";
$headers .= "Content-type: text/html\r\n";
mail($c_email,$subject,$message,$headers);
echo "<script> alert('Your Password has been sent to you, check your inbox ') </script>";
echo "<script>window.open('checkout.php','_self')</script>";
}
}
?>