Gossamer Forum
Home : Products : DBMan : Customization :

Email Notification

Quote Reply
Email Notification
Is it possible to set up an email notification that someone has added an entry to the database? I've looked everywhere but can't seem to find the answer

Thanx,

Awake
Quote Reply
Re: Email Notification In reply to
There's lots of places that I've answered this question, but it's probably easier for me to give you the code than to look for it. Smile

But first, I need some information. To whom do you want the email sent? To you, as the administrator or to the user?

Do you only want the email sent when a record is added, or do you also want one when a record is modified?



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





Quote Reply
Re: Email Notification In reply to
Sorry, JPD, I even checked out your site but couldn't see it, can't see the woods for the tree's I guess )

I just want myself notifying when someone has added a New record.

Seeing as I've got hold of you (I know how busy you are) is there a way to stop Users submitting the same record twice, i.e to stop a record with the same details being entered by 2 seperate people?

Regards,

Awake

------------------
Quote Reply
Re: Email Notification In reply to
Try these Threads:

E-mailing records
http://www.gossamer-threads.com/scripts/forum/resources/Forum12/HTML/000769.html

Ask for sub for email notify
http://www.gossamer-threads.com/scripts/forum/resources/Forum12/HTML/000458.html

Email form results to site admin, and add record to db...
http://www.gossamer-threads.com/scripts/forum/resources/Forum12/HTML/000793.html

There is also a private email mod available at the following URL:

http://www.jpdeni.com/dbman/mods.html

Also regarding your other inquiry:

Quote:
Seeing as I've got hold of you (I know how busy you are) is there a way to stop Users submitting the same record twice, i.e to stop a record with the same details being entered by 2 seperate people?

JPDeni has written some codes that can be inserted into the db.cgi that will stop people from adding the same information in other fields than the db_key variable/field. This thread is located in the DBMAN Installation Forum. I can't seem to find it right now.

Hope this helps.

Regards,

------------------
Eliot Lee
Founder and Editor
Anthro TECH, L.L.C
http://www.anthrotech.com/
info@anthrotech.com
==========================
Coconino Community College
http://www.coco.cc.az.us/
Web Technology
Coordinator
elee@coco.cc.az.us
Quote Reply
Re: Email Notification In reply to
One thing I gotta teach you folks is -- one thing at a time!!! Smile

I don't have this on my site. But I have copied down this URL, so the next person that asks will be sent here. Wink

Assuming you have sendmail on your server, add the following to default.cfg:

Code:
# Full path to sendmail on your system
$mailprog = "|/usr/lib/sendmail -t -oeq";
# Your email address
$admin_email = 'you@yourserver.com';

Make the necessary changes to the lines to match the path to sendmail and your email address. Note that in the $mailprog variable, you need to leave the | at the beginning and the -t -oeq at the end. Just edit the path to sendmail for your server.

Then, in html_add_success, right at the beginning of the subroutine, add

Code:
%rec = &get_record($in{$db_key});

open (MAIL, "$mailprog") or &cgierr("Can't start mail program");
print MAIL "To: $admin_email\n";
print MAIL "From: $admin_email\n";
print MAIL "Subject: Record Added\n\n";
print MAIL "-" x 75 . "\n\n";
print MAIL "Put the text of the message you want in here.
You can have more than one line in one print statement by just using your 'Enter' key.
If you would like to include information about the record, use the
$rec{'fieldname'} variables, just like you use in html_record.
";
close (MAIL);

I don't know how to prevent the same record details from being entered by two different people, unless there is one field that needs to be unique which you can use as the key field.


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





Quote Reply
Re: Email Notification In reply to
Hi,
Thanks for the information above, I've added the mods.

I am now experiencing a huge problem with adding records, upon adding a record, all the information that has been submitted now ends up on one line after the Join button has been clicked. I have gone through both the HTML.pl and the default.cfg but cannot find any reason for this to be happeneing. It was working fine until I changed the fields in the default.cfg to the following:

%db_def = (
ID => [0, 'numer', 10, 100, 1, '', ''],
Name => [1, 'alpha', 40, 255, 1, '', ''],
Address => [2, 'alpha', 40, 255, 1, '', ''],
City => [3, 'alpha', 40, 255, 1, '', ''],
County => [4, 'alpha', 40, 255, 1, '', ''],
Telephone => [5, 'alpha', 40, 255, 1, '', ''],

I have modify the fields in the html.pl too, but can not see how it could be corrupting>

The db is at http://www.puterpotato.com/afterdark and the problem seems to stem after the Join button has been clicked and the details submitted.

Awake
Quote Reply
Re: Email Notification In reply to
The HTMP.pl now reads:

<TABLE WIDTH="100%" CELLPADDING=0 CELLSPACING=0 BORDER=0>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>ID:</FONT></TD>
<TD VALIGN="TOP" WIDTH="475"> <INPUT TYPE="TEXT" NAME="ID" VALUE="$rec{'ID'}" SIZE="20" MAXLENGTH="100"></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Pub/Club Name:</FONT></TD>
<TD VALIGN="TOP" WIDTH="475"> <INPUT TYPE="TEXT" NAME="Name" VALUE="$rec{'Name'}" SIZE="40" MAXLENGTH="255"></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Address:</FONT></TD>
<TD VALIGN="TOP"> <INPUT TYPE="TEXT" NAME="Address" VALUE="$rec{'Address'}" SIZE="40" MAXLENGTH="255"></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>City:</FONT></TD>
<TD VALIGN="TOP"> <INPUT TYPE="TEXT" NAME="Address" VALUE="$rec{'City'}" SIZE="40" MAXLENGTH="255"></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>County:</FONT></TD>
<TD VALIGN="TOP"> <INPUT TYPE="TEXT" NAME="Address" VALUE="$rec{'County'}" SIZE="40" MAXLENGTH="255"></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Telephone:</FONT></TD>
<TD VALIGN="TOP"> <INPUT TYPE="TEXT" NAME="Address" VALUE="$rec{'Telephone'}" SIZE="40" MAXLENGTH="255"></TD></TR>
</TABLE>

and:

<TABLE WIDTH="100%" CELLPADDING=0 CELLSPACING=0 BORDER=0>
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>ID:</FONT></TD>
<TD WIDTH="80%"> <$font>$rec{'ID'}</Font></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP" WIDTH="20%"><$font_color>Name:</FONT></TD>
<TD WIDTH="80%"> <$font>$rec{'Name'}</Font></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font_color>Address:</FONT></TD>
<TD> <$font>$rec{'Address'}</Font></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font_color>City:</FONT></TD>
<TD> <$font>$rec{'City'}</Font></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font_color>County:</FONT></TD>
<TD> <$font>$rec{'County'}</Font></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font_color>Telephone:</FONT></TD>
<TD> <$font>$rec{'Telephone'}</Font></TD></TR>
</TABLE>

Am I missing something so easy?
Quote Reply
Re: Email Notification In reply to
You haven't changed the names of your input fields in your form.

Code:
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Address:</FONT></TD>
<TD VALIGN="TOP"> <INPUT TYPE="TEXT" NAME="Address" VALUE="$rec{'Address'}" SIZE="40" MAXLENGTH="255"></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>City:</FONT></TD>
<TD VALIGN="TOP"> <INPUT TYPE="TEXT" NAME="Address" VALUE="$rec{'City'}" SIZE="40" MAXLENGTH="255"></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>County:</FONT></TD>
<TD VALIGN="TOP"> <INPUT TYPE="TEXT" NAME="Address" VALUE="$rec{'County'}" SIZE="40" MAXLENGTH="255"></TD></TR>
<TR><TD ALIGN="Right" VALIGN="TOP"><$font>Telephone:</FONT></TD>
<TD VALIGN="TOP"> <INPUT TYPE="TEXT" NAME="Address" VALUE="$rec{'Telephone'}" SIZE="40" MAXLENGTH="255"></TD></TR>

The names of the input fields need to match the names of the database fields.


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





Quote Reply
Re: Email Notification In reply to
Man, now do I feel a doofus, thanx JPD, guess I still got a lot to learn, thanx for your help

Awake
Quote Reply
Re: Email Notification In reply to
It happens. Smile

But all of the mistakes are opportunities to learn. Just keep telling yourself that!


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