you are right... the solution i came up with (even though its two years later ) is to have the email include multiple passwords and usernames for each title they have on file under the email. Replace both process_form and send_email in modify_ret.cgi with the following:
sub process_form {
# --------------------------------------------------------
($in{'Email'} !~ /.+@.+\..+/[/url]) and &site_html_modify_up_ret_failure ("You did not specify a valid email address.") and return;
# Let's check to make sure the link we want to update is actually
# in the database.
open (DB, "<$db_file_name") or &cgierr("Error in validate_records. unable to open db file: $db_file_name. Reason: $!");
$found = 0;
LINE: while (<DB>) {
(/^#/) and next LINE;
(/^\s*$/) and next LINE;
chomp;
@data = &split_decode($_);
if ($data[$db_contact_email] eq $in{'Email'}) {
if ($found > 0) {
$u[$found] = $data[$db_user];
$p[$found] = $data[$db_pw];
$t[$found] = $data[$db_title];
$n[$found] = $data[$db_contact_name];
$found++;
}
else {
$u = $data[$db_user];
$p = $data[$db_pw];
$t = $data[$db_title];
$n = $data[$db_contact_name];
$found = 1;
# last LINE;
}
}
}
close DB;
!$found and &site_html_modify_up_ret_failure ("Record not found.") and return;
if ($found) {
&send_email();
&site_html_modify_up_ret_success() and return;
}
}
sub send_email {
# --------------------------------------------------------
# Sends an email to the admin, letting him know that there is
# a new link waiting to be validated.
if ($n =~ /^(\w+)\s\w+$/) {
$n = $1;
}
# Check to make sure that there is an admin email address defined.
$db_admin_email or &cgierr("Admin Email Address Not Defined in config file!");
my $to = $in{'Email'};
my $from = $db_admin_email;
my $subject = "Password retrieval for: $t";
my $msg = qq|Hello $n,|;
$found = $found - 1;
if ($found > 0) {
$msg .= qq|
Here are your Contact Names and Passwords for all your listings:
Company Name : $t
Username : $u
Password : $p
|;
$number = 1;
while ($found >= $number) {
$msg .= qq|
Company Name : $t[$number]
Username : $u[$number]
Password : $p[$number]
|;
$number++;
}
} else {
$msg .= qq|
Here is your Contact Name and Password:
Username : $u
Password : $p|;
}
$msg .= qq|
found is $found
Please login here:
$db_cgi_url/modify.cgi
Sincerely,
Links Manager.
|;
# Then mail it away!
require "$db_lib_path/Mailer.pm";
my $mailer = new Mailer ( { smtp => $db_smtp_server,
sendmail => $db_mail_path,
from => $from,
subject => $subject,
to => $to,
msg => $msg,
log => $db_mailer_log
} ) or return undef;
$mailer->send or return undef;
}
Hope that helps :D
Vote Stinky
Code:
sub process_form {
# --------------------------------------------------------
($in{'Email'} !~ /.+@.+\..+/[/url]) and &site_html_modify_up_ret_failure ("You did not specify a valid email address.") and return;
# Let's check to make sure the link we want to update is actually
# in the database.
open (DB, "<$db_file_name") or &cgierr("Error in validate_records. unable to open db file: $db_file_name. Reason: $!");
$found = 0;
LINE: while (<DB>) {
(/^#/) and next LINE;
(/^\s*$/) and next LINE;
chomp;
@data = &split_decode($_);
if ($data[$db_contact_email] eq $in{'Email'}) {
if ($found > 0) {
$u[$found] = $data[$db_user];
$p[$found] = $data[$db_pw];
$t[$found] = $data[$db_title];
$n[$found] = $data[$db_contact_name];
$found++;
}
else {
$u = $data[$db_user];
$p = $data[$db_pw];
$t = $data[$db_title];
$n = $data[$db_contact_name];
$found = 1;
# last LINE;
}
}
}
close DB;
!$found and &site_html_modify_up_ret_failure ("Record not found.") and return;
if ($found) {
&send_email();
&site_html_modify_up_ret_success() and return;
}
}
sub send_email {
# --------------------------------------------------------
# Sends an email to the admin, letting him know that there is
# a new link waiting to be validated.
if ($n =~ /^(\w+)\s\w+$/) {
$n = $1;
}
# Check to make sure that there is an admin email address defined.
$db_admin_email or &cgierr("Admin Email Address Not Defined in config file!");
my $to = $in{'Email'};
my $from = $db_admin_email;
my $subject = "Password retrieval for: $t";
my $msg = qq|Hello $n,|;
$found = $found - 1;
if ($found > 0) {
$msg .= qq|
Here are your Contact Names and Passwords for all your listings:
Company Name : $t
Username : $u
Password : $p
|;
$number = 1;
while ($found >= $number) {
$msg .= qq|
Company Name : $t[$number]
Username : $u[$number]
Password : $p[$number]
|;
$number++;
}
} else {
$msg .= qq|
Here is your Contact Name and Password:
Username : $u
Password : $p|;
}
$msg .= qq|
found is $found
Please login here:
$db_cgi_url/modify.cgi
Sincerely,
Links Manager.
|;
# Then mail it away!
require "$db_lib_path/Mailer.pm";
my $mailer = new Mailer ( { smtp => $db_smtp_server,
sendmail => $db_mail_path,
from => $from,
subject => $subject,
to => $to,
msg => $msg,
log => $db_mailer_log
} ) or return undef;
$mailer->send or return undef;
}
Hope that helps :D
Vote Stinky