Gossamer Forum
Home : Products : DBMan : Installation :

Uniq Email?

Quote Reply
Uniq Email?
DBMAN is a wonderful script!, I'm working on a mailinglist manager based on DBMAN 2.01. With some nice featurs like "User approving" of subscribsions, to avoid beening accused of spamming. To make everything work i need to be sure of that the field "Email" is uniq.

So I need to modify "sub validate_records", The problem is that I don't have any idears what to do. Alex could you help me?

Here is "sub validate_records"

if ($in{'add_record'}) { # don't need to worry about duplicate key if modifying
open (DB, "<$db_file_name") or &cgierr("error in validate_records. unable to open db file: $db$
LINE: while (<DB> ) {
(/^#/) and next LINE;
(/^\s*$/) and next LINE;
$line = $_; chomp ($line);
($id, @rest) = &split_decode($line);

if ($id eq $in{$db_key}) {
return "duplicate key error";
}
}
close DB;
}

Cheers,

Jonas
Quote Reply
Re: Uniq Email? In reply to
Easiest way would be to make the database key the email address. Then just change the error message from "duplicate key error" to "email address already in database".

By the way you might be interested in:

http://gossamer-threads.com/...ce/nph-mail.cgi .txt

which will manage one/multiple mailing lists.

Cheers,

Alex