Gossamer Forum
Home : Products : DBMan : Customization :

Unsecure Password Mod

Quote Reply
Unsecure Password Mod
I've modified the unsecure password lookup mod using fragments of code found in this forum (am very "code-challenged"). Rather than search the password file, I want it to search the database for matching email and send the results. I've gotten it beyond error codes. It just doesn't find any matching emails, although they do exist. Any help would be appreciated.

#############################################################################################
#
# file: db.cgi -- new subroutine

sub lookup {
# --------------------------------------------------------
my $found = 0;

unless ($in{'email'} =~ /.+\@.+\..+/) {
&html_lookup_form ("Invalid email address");
}

else {
open (DB, "<$db_file_name") || &cgierr("unable to open database file. Reason: $!\n");
if ($db_use_flock) {
flock(DB, 2);
}
@lines = <DB>;
close DB;
foreach $line (@lines) {
@data = split /\|/, $line;
$email = $data[3];
$userid = $data[15];
$pw = $data[16];
}
if (($in{'email'}) eq ($email)) {
$found=1;
$mailtext = "To: $email\n";
$mailtext .= "From: $admin_email\n";
$mailtext .= "Subject: $db_name Account Information\n\n";

$mailtext .= "-" x 60 . "\n\n";

$mailtext .= "You requested your $db_name account information:\n\n";

$mailtext .= "Your $db_name User ID is: $userid\n";
$mailtext .= "Your $db_name password is: $pw\n\n";

$mailtext .= "please contact $db_name support at: $admin_email\n";
$mailtext .= "if you have any questions.\n\n";

if ($db_debug) { $message = $mailtext; }
else {
open (MAIL, "$mailprog") || print "Can't start mail program";
print MAIL $mailtext;
close (MAIL);
}
last LINE;
}
}
if ($found) { &html_lookup_success($message); }
else { &html_lookup_form ("Oops! Email address <B>$in{'email'}</B> was not found. <BR> Please contact the webmaster for further assistance."); }
}