Gossamer Forum
Home : Products : DBMan : Customization :

email notification

Quote Reply
email notification
Is there a feautre when a visitor signup online, he/she and the admin both will be notified by email?

Sign up user require admin to approve to get their record listed.

Thanks,
george
Quote Reply
Re: email notification In reply to
1) Download and install the Secure Password Lookup Mod:


2) Download and install the Validation Mod:


Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
Quote Reply
Re: email notification In reply to
I don't think either one of those mods will do what you want--not completely anyway. The Secure Password Lookup mod will add a field for the user's email address, which is part of what you need.

You'll probably want to have the user enter more than just email address and user name, so you will need to add fields to sub html_signup_form. (Otherwise how will you know who to accept and who to reject? Smile )

You're probably going to need a separate file for "pending" users, which would be separate from the .pass file. And some way for you as admin to move a user from the "pending" file to the .pass file after he/she has been approved. We might need to work on how to work that out.

Sending the email to you and the user isn't a problem. Below is from the Secure Password Lookup mod, with a few changes. Naturally, you would change to wording to suit your own situation.

Code:
open (MAIL, "$mailprog") | | &cgierr("Can't start mail program");
print MAIL "To: $in{'email'}\n";
print MAIL "From: $admin_email\n";
print MAIL "Subject: $html_title Account Request Received\n\n";
print MAIL "-" x 75 . "\n\n";
print MAIL "Your account at $html_title has been entered.\n\n";
print MAIL "You will be contacted soon after your account has been approved\n\n";
close (MAIL);
open (MAIL, "$mailprog") | | &cgierr("Can't start mail program");
print MAIL "To: $admin_email\n";
print MAIL "From: $admin_email\n";
print MAIL "Subject: $html_title Account Created\n\n";
print MAIL "-" x 75 . "\n\n";
print MAIL "The following person has requested an account:\n\n";
print MAIL "Email: $in{'email'}\n";
print MAIL "label: $in{'fieldname'}\n";
# Repeat as needed for each field you have added to the signup form
print MAIL "\n\n";
close (MAIL);

Does this make sense?


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





Quote Reply
Re: email notification In reply to
Dear AnthroRules and JPDeni,

Thank you both for your help.

To JPDeni,

Where should I insert the code to?

Actually I want a light version of "Links",
without listing, view/search by myself (admin) only. But I need to more fields when user submit theirs online!

Is this possible?

Regards,
george
Quote Reply
Re: email notification In reply to
You want a lite version of "Links"? You might have better luck in the Links forum than here. I've worked with Links, but not enough to be able to answer questions about it.

The code I gave you would go into db.cgi, in sub signup. But there would have to be a lot of other coding before you could really use it. I'd really need to know exactly what you want to do first.


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





Quote Reply
Re: email notification In reply to
JPD,

What I want to run is a closed database. someone submit their record online and only admin can view/search it. When visitor submit it, they got confirmation by email and I got a notification. I hope the program can check the duplicated entry for one more filed except ID field and allowed admin to send mass mailing. 2 levels display mod.
The program is somewhat like link, but has more fields and needn't generate htmls and open for public to search, admin function only!

Is this complicated?

george
Quote Reply
Re: email notification In reply to
That explains things much better.

There are several things you are working with here. Let's take them one at a time.

I'm going to assume that you will not require users to register before they add a record. Is this correct? If so, you would want the following in your .cfg file:

$auth_allow_default = 1;
@auth_default_permissions = (0,1,0,0,0);
$auth_signup = 0;
$auth_user_field = -1;

(The rest of the permissions wouldn't matter.)

Then you want to have email sent to the admin and the user after a record is added.

(I tried doing a search for this, because I know it's here, but I couldn't figure out what search terms to use.)

In your .cfg file, add

$mailprog = 'the path to sendmail on your system';
$admin_email = 'your email address';

In html.pl, sub html_add_success, add the following, right at the beginning of the subroutine:

Code:
open (MAIL, "$mailprog") | | &cgierr("Can't start mail program");
print MAIL "To: $in{'email'}\n";
print MAIL "From: $admin_email\n";
print MAIL "Subject: $html_title Information Received\n\n";
print MAIL "-" x 75 . "\n\n";
print MAIL "The following information was received at $html_title.\n\n";
foreach $column (@db_cols) {
print MAIL "$column: $in{$column}\n";
}
print MAIL "Thank you for adding your information.";
close (MAIL);

open (MAIL, "$mailprog") | | &cgierr("Can't start mail program");
print MAIL "To: $admin_email\n";
print MAIL "From: $admin_email\n";
print MAIL "Subject: $html_title Information Received\n\n";
print MAIL "-" x 75 . "\n\n";
print MAIL "The following information was received at $html_title.\n\n";
foreach $column (@db_cols) {
print MAIL "$column: $in{$column}\n";
}
close (MAIL);

Checking for duplicated records can be tricky. I would need to know how many records you need to check, what their names are, and whether all of the values would have to be the same (or just one of them) before the record would be rejected.

For mass mailing, you might look at www.gossamer-threads.com/scripts/forum/resources/Forum12/HTML/001886.html

The short/long display mod is at
www.jpdeni.com/dbman/Mods/short_html_pl.txt



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







[This message has been edited by JPDeni (edited March 20, 2000).]
Quote Reply
Re: email notification In reply to
Dear JPD,

I think it works great!

But if I want to have following 2 field check:

1. check field [1] "id" unique, no duplicate entry.

2. check field [11] "email" field is the right format. since I will add mass mail feature on it.

Can you help me? Thanks.

george
Quote Reply
Re: email notification In reply to
1) Check for IDs with the following variable settings in your links.cfg file:

Code:
$db_key = 'ID';

AND

Code:
$db_key_track = 1;

2) To make sure that people fill in the correct email format, change your email field to the following in the %db_def hash section in the default.cfg file:

Code:
Email => [19, 'alpha', 40, 255, 0, '', '.+\@.+\..+'],

Change 19 to your Email field number.

Hope this helps.

Regards,

------------------
Eliot Lee....
Former Handle: Eliot
* Check Resource Center
* Search Forums
Quote Reply
Re: email notification In reply to
Eliot,

Thank you fro your reply.

Email field check works fine.

Refer to the user id, I mean I have another
field call "another_id", it is different from the filed[0] . This additional field also need to check to avoid duplicat entry. Any idea?

george
Quote Reply
Re: email notification In reply to
You can check another field for duplicates by adding the bolded lines to sub validate_record in the db.cgi script:

Code:
LINE: while (<DB> ) {
(/^#/) and next LINE;
(/^\s*$/) and next LINE;
$line = $_; chomp ($line);
@data = &split_decode($line);
if ($data[$db_key_pos] eq $in{$db_key}) {
return "duplicate key error";
}
if ($data[number of second field] eq $in{'name of second field'}) {
return "duplicate entry";
}

}

You may want to change "duplicate entry" to something more descriptive of what your situation is.


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





Quote Reply
Re: email notification In reply to
Dear JPD,

It works great! Thank you all for your help.

george
Quote Reply
Re: email notification In reply to
Is it possible to move the mailer (mass mailing) routine into the system?

Thanks,
george
Quote Reply
Re: email notification In reply to
Probably. Smile

It would take some time to work out the coding.


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






Quote Reply
Re: email notification In reply to
Hello JPDeni,

I found you're answer on this question, but i have still a small question. How do i use two fields to controle duplicates.

Something like:

if ($data[number of second field] eq $in{'name of second field'}) and if ($data[number of third field ] eq $in{'name of third field'}){ return "duplicate entry";

Please help me.

Gerard
The Netherlands
Quote Reply
Duplicate Entries in Another field In reply to
In Reply To:
You can check another field for duplicates by adding the bolded lines to sub validate_record in the db.cgi script:

Code:
LINE: while (<DB> ) {
(/^#/) and next LINE;
(/^\s*$/) and next LINE;
$line = $_; chomp ($line);
@data = &split_decode($line);
if ($data[$db_key_pos] eq $in{$db_key}) {
return "duplicate key error";
}
if ($data[number of second field] eq $in{'name of second field'}) {
return "duplicate entry";
}

}

This looks like it should do what I want it to - but I have experimented with a few varities of syntax with no progresss. can anyone advise me if I have the right idea.... Number of second field - in this case it's a field named record owner and it's the second field in the db definition (ie '1' - as in '0' is the first - db key, and '1' is the next - Record_Owner) The idea being that I want the admin to be prompted that there is already a Record Owner with that name if they try to add a record with the same name as a previous record owner. So - I have editted the following line to be.... if ($data[1] eq $in{'Record_Owner'}) {
return "duplicate entry";
But it doesn't seem to do the check that I want it to. Ian
Quote Reply
Re: [ianmarie] Duplicate Entries in Another field In reply to
Does the error appear when you try and enter an existing value in that field?

It will not notify admin, but will display an error so the user will have to make another choice for that field value.

Unoffical DBMan FAQ

http://creativecomputingweb.com/dbman/index.shtml/