Gossamer Forum
Home : Products : DBMan : Installation :

Making email address appear in new entry

Quote Reply
Making email address appear in new entry
I have an email that's entered with the id and password, using the special look-up feature.

How can I make that same e-mail address appear in the email field of a new record?

Thanks for considering this.

Catster
Quote Reply
Re: Making email address appear in new entry In reply to
There's a couple of ways of going about this. I'm trying to figure out the easiest.

I think the best thing would be to add a subroutine to db.cgi.

Code:
sub get_email {
#--------------------------------------
my (@lines, $line, @data);
open (PASS, "<$auth_pw_file") or &cgierr ("unable to open: $auth_pw_file.\nReason: $!");
if ($db_use_flock) { flock(PASS, 1) } @lines = <PASS>;
close PASS;

foreach $line (@lines) {
@data = split (/:/, $line);
if ($data[0] eq $db_userid) {
return $data[7];
}
}
}

Then, in your .cfg file, where you define your fields, use

&get_email

as the default value. Don't put quotes around it.

I haven't tested this, but it should work. (I need to put that in my sig file! Smile )

------------------
JPD