-
Notifications
You must be signed in to change notification settings - Fork 32
/
user_password_recover.php
174 lines (122 loc) · 4.74 KB
/
user_password_recover.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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
<?php
session_start();
include_once("admin/class/adminback.php");
$obj = new adminback();
$cata_info = $obj->p_display_catagory();
$cataDatas = array();
while ($data = mysqli_fetch_assoc($cata_info)) {
$cataDatas[] = $data;
}
if (isset($_SESSION['user_id'])) {
header("location:userprofile.php");
}
if (isset($_POST['u_pass_recover'])) {
$recover_email = $_POST['recover_email'];
$rec_row = $obj->user_password_recover($recover_email);
$num_row = mysqli_num_rows($rec_row);
$rec_msg = "";
if ($num_row > 0) {
$rec_result = mysqli_fetch_assoc($rec_row);
$rec_id = $rec_result['user_id'];
$rec_name = $rec_result['user_firstname'];
$rec_email = $rec_result['user_email'];
$rec_pass = $rec_result['user_password'];
$to_email = $rec_email;
$subject = "Recover Password From Fruits Bazar";
$body = "Dear {$rec_name}".PHP_EOL. "Please visit this link to reset your password: http://localhost/projects/Fruits_bazar_ecommerce_project/user_password_update.php?status=update&&id={$rec_id}".PHP_EOL."Thank you";
$headers = "From: graphicsapon@gmail.com";
if (mail($to_email, $subject, $body, $headers)) {
$rec_msg= "Please check your email and reset password";
} else {
$rec_msg = "Email sending failed...";
}
} else {
$rec_msg = "Sorry !!! you have no account";
}
}
?>
<?php
include_once("includes/head.php");
?>
<body class="biolife-body">
<!-- Preloader -->
<?php
include_once("includes/preloader.php");
?>
<!-- HEADER -->
<header id="header" class="header-area style-01 layout-03">
<?php
include_once("includes/header_top.php");
?>
<?php
include_once("includes/header_middle.php");
?>
<?php
include_once("includes/header_bottom.php");
?>
</header>
<!-- Page Contain -->
<div class="page-contain">
<!-- Main content -->
<div id="main-content" class="main-content">
<div class="container">
<h2 class="text-center">Password Recovery</h2>
<h4 class="text-danger"> <?php
if (isset($rec_msg )) {
echo $rec_msg ;
}
?></h4>
<div class="row">
<!--Form Sign In-->
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
<div class="signin-container">
<form action="" name="frm-login" method="post">
<p class="form-row">
<label for="email">Email</label>
<input type="email" id="fid-name" name="recover_email" class="txt-input">
</p>
<p class="wrap-btn">
<input type="submit" value="Recover Password" name="u_pass_recover" class="btn btn-success">
</p>
</form>
</div>
</div>
<!--Go to Register form-->
<div class="col-lg-6 col-md-6 col-sm-6 col-xs-12">
<div class="register-in-container">
<div class="intro">
<h4 class="box-title">New Customer?</h4>
<p class="sub-title">Create an account with us and you’ll be able to:</p>
<ul class="lis">
<li>Check out faster</li>
<li>Save multiple shipping anddesses</li>
<li>Access your order history</li>
<li>Track new orders</li>
<li>Save items to your Wishlist</li>
</ul>
<a href="user_register.php" class="btn btn-bold">Create an account</a>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!-- FOOTER -->
<?php
include_once("includes/footer.php");
?>
<!--Footer For Mobile-->
<?php
include_once("includes/mobile_footer.php");
?>
<?php
include_once("includes/mobile_global.php")
?>
<!-- Scroll Top Button -->
<a class="btn-scroll-top"><i class="biolife-icon icon-left-arrow"></i></a>
<?php
include_once("includes/script.php")
?>
</body>
</html>