forked from ivannovak/jpmaster77-s-Login-System-
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathforgotpass.php
executable file
·88 lines (82 loc) · 2.66 KB
/
forgotpass.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
<?php
/**
* ForgotPass.php
*
* This page is for those users who have forgotten their
* password and want to have a new password generated for
* them and sent to the email address attached to their
* account in the database. The new password is not
* displayed on the website for security purposes.
*
* Note: If your server is not properly setup to send
* mail, then this page is essentially useless and it
* would be better to not even link to this page from
* your website.
*
* Written by: Jpmaster77 a.k.a. The Grandmaster of C++ (GMC)
* Last Updated: August 2, 2009 by Ivan Novak
*/
include("include/session.php");
?>
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>Jpmaster77's Login Script</title>
<link rel="stylesheet" href="-css/960/reset.css" type="text/css" />
<link rel="stylesheet" href="-css/960/960.css" type="text/css" />
<link rel="stylesheet" href="-css/960/text.css" type="text/css" />
<link rel="stylesheet" href="-css/style.css" type="text/css" />
</head>
<body>
<div id="main" class="container_12">
<?php
/**
* Forgot Password form has been submitted and no errors
* were found with the form (the username is in the database)
*/
if(isset($_SESSION['forgotpass'])){
/**
* New password was generated for user and sent to user's
* email address.
*/
if($_SESSION['forgotpass']){
echo "<h1>New Password Generated</h1>";
echo "<p>Your new password has been generated "
."and sent to the email <br>associated with your account. "
."<a href=\"main.php\">Main</a>.</p>";
}
/**
* Email could not be sent, therefore password was not
* edited in the database.
*/
else{
echo "<h1>New Password Failure</h1>";
echo "<p>There was an error sending you the "
."email with the new password,<br> so your password has not been changed. "
."<a href=\"main.php\">Main</a>.</p>";
}
unset($_SESSION['forgotpass']);
}
else{
/**
* Forgot password form is displayed, if error found
* it is displayed.
*/
?>
<h1>Forgot Password</h1>
A new password will be generated for you and sent to the email address<br>
associated with your account, all you have to do is enter your
username.<br><br>
<?php echo $form->error("user"); ?>
<form action="process.php" method="POST">
<b>Username:</b> <input type="text" name="user" maxlength="30" value="<?php echo $form->value("user"); ?>">
<input type="hidden" name="subforgot" value="1">
<input type="submit" value="Get New Password">
</form>
<p><a href="main.php">[Back to Main]</a></p>
<?php
}
?>
</div>
</body>
</html>