I see what you're doing. Not too bad, just a little fixing needed.
In sub forward_email, you don't need
Code:
unless ($admin_email) { $message = "You must fill in the recipient's email address<BR>"; }
unless ($admin_email =~ /.+\@.+\..+/) { $message = "The recipient's email address is not in the correct format.<BR>"; }
Presumably you have already set this correctly in your .cfg file. If you haven't, the user couldn't do anything about it anyway.
You can also eliminate
Code:
for ($i = 0; $i <= $#db_cols; $i++) {
if ($db_email_field eq $db_cols[$i]) {
$found = 1;
last;
}
}
if (!$found) {
$message .= "email field not found<BR>";
}
In its place, add
Code:
$in{$db_cols[$auth_user_field]} = $db_userid;
my ($status,@hits) = &query("view");
if ($status eq 'ok') {
%rec = &array_to_hash(0,@hits);
}
else {
$message .= "Your email address could not be found in the database.";
}
The rest is fine. (At least it seems so to me. Let me know if this works.
)
JPD
http://www.jpdeni.com/dbman/