Gossamer Forum
Home : Products : DBMan : Installation :

E-Mail Notification of Modify and Delete

Quote Reply
E-Mail Notification of Modify and Delete
Dear dbman think tankers,

I was able to get the e-mail notification for new entries going with "sendmail."

The notification of Modify and Delete would help serve as a backup to the database, itself, and would relieve my data loss paranoias.

Could someone explain exactly where to put these in the script?

Thanks again,
Carolynn
Quote Reply
Re: E-Mail Notification of Modify and Delete In reply to
Hi Carolynn,

I had to fiddle around with db.cgi a lot and from what I see there is always a &html_(action)_success in the sub routines. As in the Logon Success I would say if you put the routine in there it should notify you everytime a record is added, modified or deleted. You should also be able to add the UserID ( in the From line
Code:
print MAIL "From:$in{'userid'}\n";
to the mail so you know who actually did it .

I just posted the code I put in to send a mail to a User after successful Account Creation. Maybe that will help you too .
See www.gossamer-threads.com/scripts/forum/resources/Forum12/HTML/000070.html


Hope it works....<g>

Good luck Wink

Broder

[This message has been edited by Broder (edited March 02, 1999).]
Quote Reply
Re: E-Mail Notification of Modify and Delete In reply to
It depends on what you want in the email. If you just want to be notified, putting the sendmail routine in html.pl, sub html_[whatever]_success would work just fine. If you want the data to be sent to you, it will still work if you put the sendmail in html_modify_success, because the subroutine pulls in the data to display it. But it won't work in html_delete_success, because the only information that subroutine gets is the $db_key value for the record. By the time the script gets to html_delete_success, the data has gone bye-bye.

If you're concerned about archiving deleted records, you might take a look at a thread a while back about an archive db. (I know that "archive db" was part of the title.) The search isn't working too well on the forum, but if you set the page to show messages from the past 20 days and scroll down, you'll see it. (sorry. I'm too lazy to look it up myself! Smile )



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

All my advice is offered on the basis of kindness-ware. If I've helped you to solve a problem, go out of your way to be kind to someone today.

Quote Reply
Re: E-Mail Notification of Modify and Delete In reply to
Has anyone ever actually documented the "add sendmail to dbman procedure" outside this Forum? I think all these little tidbits need to be in a real, updated FAQ somewhere because they're certainly frequently asked questions....



------------------
Wayne Hunt
Amiga.org
http://www.amiga.org

Quote Reply
Re: E-Mail Notification of Modify and Delete In reply to
Such a FAQ is in the works. I've been working on one and I know of at least one other person who is doing something similar. Stay tuned! Smile


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

All my advice is offered on the basis of kindness-ware. If I've helped you to solve a problem, go out of your way to be kind to someone today.

Quote Reply
Re: E-Mail Notification of Modify and Delete In reply to
Yes. Giving you the key for the deleted data isn't a problem.

The keys are passed to the html_delete_success subroutine, in the $message variable.

You could do easily add an email to html_delete_success that just said something like

"The following records were deleted: $message"

Quote Reply
Re: E-Mail Notification of Modify and Delete In reply to
Hello from Tennessee,

Thanks big for your responces.

The previous post about moving deleted records to a seperate file originated on Feb 16. Entitled "Build Archive DB."

The email notification of adds, mods, and deletes would give the DBMan administrator the ability to -completely- reconstruct things if there were a data loss or permanent server malfunction. (Even without a recent data back-up.)

Although the data in the deletion subroutine gets dumped, is it still possible to have just the record number emailed that it could be later cross-referenced ??

Where and what would you insert into the script?

appreciatively yours once more, JPDeni and Alex

Carolynn Anderson



Quote Reply
Re: E-Mail Notification of Modify and Delete In reply to
Way to go, JPDeni, you have now provided us with the recipe for a _complete backup_ system via e-mail.

This is a more excellent way than regular backups alone or having deleted pages filed elsewhere on the server. Hard drives fail everyday and data in one's cgi-bin vanishes without a trace.

I'll be thinking about you when I perform the next act of random kindness. :-D

Carolynn
Quote Reply
Re: E-Mail Notification of Modify and Delete In reply to
Hooowdy,

Got the add and mod e-mail notification working great by altering the db.cgi.

When I adjusted the html.pl file to get a delete message mailed to me, I received 6 or 7 emails - only one of which contained the record number (key).

Granted, I did create the sample record and did delete it in the same session, but so might others.

Any work-arounds ?

In: sub html_delete_success

</body>
</html>
|;
}

{
open (MAIL, "|/usr/lib/sendmail -t") or &cgierr("Can't open sendmail:
$!");
print MAIL "To: hcnet\@aol.com\n";
print MAIL "From: where2or3\@aol.com\n";
print MAIL "Subject: Registry Record Deletion\n\n";
print MAIL " \n";
print MAIL "This record was deleted: $message\n";
print MAIL " \n";
print MAIL "Thank You\n";
print MAIL " \n";

close MAIL;
}

sub html_delete_failure {
# --------------------------------------------------------
....