-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpasswd.php
More file actions
102 lines (87 loc) · 2.71 KB
/
Copy pathpasswd.php
File metadata and controls
102 lines (87 loc) · 2.71 KB
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
<?php
// GiftWeb: PHP/PostgreSQL online Gift Registry System
// Matthew T. Jachimstal
// Copyright (C) 2000-2008 Matthew T. Jachimstal
//
// email: matthew@jachimstal.com
//
// Snail mail: Matthew Jachimstal
// 1106 Canterbury Ct, Unit D
// Elgin, IL 60120
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.
//
// You should have received a copy of the GNU General Public License
// along with this program; if not, write to the Free Software
// Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
//
//
require "./main.inc";
require "./util.php";
require "./pwgen.class.php";
$conn = ADONewConnection($dbtype);
$conn->PConnect($dbhost, $dbuser, $dbpass, $dbname);
if ( isset($_POST["submit1"]))
{
process_form();
}
show_form();
function process_form()
{
global $conn;
$email = $_POST["email"];
$sql = "SELECT passwd, login FROM users WHERE email='$email'";
$result = $conn->Execute($sql);
if ( $result->RecordCount() != 1 )
{
$err = "<h2>An error has occured retrieving your password. Please ";
$err .= "try again. If the problem persists, contact the site ";
$err .= "administrator. Thank you.</h2>";
}
else
{
$passwd = chop($result->fields["passwd"]);
$login = chop($result->fields["login"]);
$to = $email;
$subject = "GiftWeb Password Reminder";
$from = "From: GiftWeb <" . $email . ">";
$text = "The password for username $login is $passwd";
mail($to, $subject, $text, $from);
startpage_old("Mail sent", -2);
?>
<h2>A new password has been mailed to you.</h2>
<?php
redir("./index.php", "the GiftWeb login page", 3);
}
}
function show_form()
{
echo "abc";
$uid=-1;
startpage_old("Email password reminder", -2);
echo $err;
?>
<form method="post" action="passwd.php">
Please enter your username and email address.<br>
A new password will be mailed to you shortly.<p>
<table border=0 cellspacing=0 cellpadding=0>
<tr><td align=right>Username:</td>
<td align=left><input type="text" name="username" maxlength=20 size=20></td></tr>
<tr><td align=right>Email Address:</td>
<td align=left><input type="text" name="email" maxlength=40
size=40></td></tr>
<tr></tr>
<tr><td><input type="submit" name="submit1" value="Submit"></td>
<td></td></tr></table>
<?php
endpage_old(-1);
}
?>