This repository has been archived by the owner on Oct 29, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathrecover_password2.php
executable file
·85 lines (62 loc) · 2.06 KB
/
recover_password2.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
session_start();
require("include/functions.php");
$config_file = 'config.php';
if (file_exists($config_file)) {
require("config.php");
} else {
header("Location: error.php?e=config");
die();
}
require("include/apply_config.php");
$sumitted_email=filter_var($_POST["sumitted_email"], FILTER_SANITIZE_EMAIL);
echo "<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">
<html>
<head>
<title>$app_custom_name - Recover Password</title>";
require("include/get_css.php");
#Execute custom code for head, if set
if (is_file("$absolute_dir/customhead.php")) {
include("customhead.php");
}
?>
</head>
<body>
<!--Blueprint container-->
<div class="container">
<div class="span-24 last">
</div>
<div class="span-24 last">
<H4>Recover password</H4>
<?php
$query = ("SELECT UserName, UserEmail,UserPassword FROM Users WHERE UserEmail='$sumitted_email'");
$result = mysqli_query($connection, $query)
or die ("Could not execute query. Please try again later.");
$nrows = mysqli_num_rows($result);
if ($nrows==1) {
$row = mysqli_fetch_array($result);
extract($row);
if ($app_custom_name=="")
$app_custom_name="Pumilio";
$to = "<$UserEmail>";
$subject = "Password recovery";
$headers = "From: <$app_admin_email>";
$mess = "\nPassword reminder for $app_custom_name:\n\n Your username is: $UserName\n Your password is: $UserPassword\n";
if (!mail($to, $subject, $mess, $headers)){
echo "This system failed to send the email. Please consult with the administrator to reset/recover your password. The administrator email is: $app_admin_email";
}
else {
echo "A reminder email has been sent. Check your email in a couple of minutes for your username and password. If you can not find the reminder in your inbox, check your spam or junk folder or contact your administrator.";
}
}
else {
echo "That email does not exists in the system. Please check for errors and try again.";
}
?>
</div>
<div class="span-24 last">
</div>
</body>
</html>