-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathforgotpassword.php
124 lines (97 loc) · 4.01 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
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
<!doctype html>
<html class="fixed">
<head>
<!-- Basic -->
<meta charset="UTF-8">
<tilte>MMT</tilte>
<meta name="keywords" content="HTML5 Admin Template" />
<meta name="description" content="Porto Admin - Responsive HTML5 Template">
<meta name="author" content="okler.net">
<!-- Mobile Metas -->
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
<!-- Web Fonts -->
<link href="http://fonts.googleapis.com/css?family=Open+Sans:300,400,600,700,800|Shadows+Into+Light" rel="stylesheet" type="text/css">
<!-- Vendor CSS -->
<link rel="stylesheet" href="assets/vendor/bootstrap/css/bootstrap.css" />
<link rel="stylesheet" href="assets/vendor/font-awesome/css/font-awesome.css" />
<link rel="stylesheet" href="assets/vendor/magnific-popup/magnific-popup.css" />
<link rel="stylesheet" href="assets/vendor/bootstrap-datepicker/css/datepicker3.css" />
<!-- Theme CSS -->
<link rel="stylesheet" href="assets/stylesheets/theme.css" />
<!-- Skin CSS -->
<link rel="stylesheet" href="assets/stylesheets/skins/default.css" />
<!-- Theme Custom CSS -->
<link rel="stylesheet" href="assets/stylesheets/theme-custom.css">
<!-- Head Libs -->
<script src="assets/vendor/modernizr/modernizr.js"></script>
</head>
<body>
<!-- start: page -->
<section class="body-sign">
<div class="center-sign">
<div class="panel panel-sign">
<div class="panel-title-sign mt-xl text-right">
<h2 class="title text-uppercase text-bold m-none"><i class="fa fa-user mr-xs"></i> Recover Password</h2>
</div>
<div class="panel-body">
<div class="alert alert-info">
<p class="m-none text-semibold h6">Enter your e-mail below and we will send you reset instructions!</p>
</div>
<form method="POST">
<div class="form-group mb-none">
<div class="input-group">
<input type="email" placeholder="E-mail" id="Email" name="Email" class="form-control input-lg" />
<span class="input-group-btn">
<button class="btn btn-primary btn-lg" type="submit" id="Reset" name="Reset">Reset!</button>
</span>
</div>
</div>
<p class="text-center mt-lg">Remembered? <a href="index.php">Sign In!</a>
</form>
</div>
</div>
</div>
</section>
<!-- end: page -->
<!-- Vendor -->
<script src="assets/vendor/jquery/jquery.js"></script>
<script src="assets/vendor/jquery-browser-mobile/jquery.browser.mobile.js"></script>
<script src="assets/vendor/bootstrap/js/bootstrap.js"></script>
<script src="assets/vendor/nanoscroller/nanoscroller.js"></script>
<script src="assets/vendor/bootstrap-datepicker/js/bootstrap-datepicker.js"></script>
<script src="assets/vendor/magnific-popup/magnific-popup.js"></script>
<script src="assets/vendor/jquery-placeholder/jquery.placeholder.js"></script>
<!-- Theme Base, Components and Settings -->
<script src="assets/javascripts/theme.js"></script>
<!-- Theme Custom -->
<script src="assets/javascripts/theme.custom.js"></script>
<!-- Theme Initialization Files -->
<script src="assets/javascripts/theme.init.js"></script>
</body>
</html>
<?php
session_start();
include("include/conn.php");
if(isset($_POST['Reset'])){
$Email = $_POST['Email'];
$sql = "SELECT * FROM admin WHERE Email = '$Email'";
$res = mysqli_query($conn, $sql);
$count = mysqli_num_rows($res);
if($count == 1){
$r = mysqli_fetch_assoc($res);
$password = $r['Password'];
$to = $r['Email'];
$subject = "Your Recovered Password";
$message = "Please use this password to login: " . $password;
if (mail($to, $subject, $message, 'From: [email protected]')) {
echo("<script>alert('Check Email!');</script>");
} else {
echo "<script>alert('Error!');</script>";
}
}
else{
echo "<script> alert('Email does not exist in database') </script>";
}
}else
echo "<script> alert('Emddddddddail does not exist in database') </script>";
?>