Hi,
I've modified add.cgi to use a unique identifier tag 'Rcpt' (passed as add.cgi?Rcpt=xxxxxx) to put in field 'rcpt' and it works fine, but I've found that someone can go back and re-use the form to submit another entry with the same rcpt reference - I don't want that.
I'd like add.cgi to check the currect links database for 'rcpt' and report an error if it finds and existing entry with the same rcpt reference (this is to stop them using the form for more than one submission.)
I've setup the error reporting and checking for the presence of 'rcpt', so now I just need a code snippet to check the links.
In my v1.13 I have the duplicate URL check that uses $db->query and $db->hits to establish if the input for 'URL' exists, but it doesn't appear to work the same for 2.x
Here's what I'm using:
my $chk_rcp = $db->query ( { rcpt => $IN->param('rcpt') } );
if ($chk_rcp) {
print $IN->header();
print Links::SiteHTML::display('error', { error => Links::language('DUP_RCPT')});
exit;
}... but this returns the error every time.
Firstly, have I got the query right?
Secondly, how would I check for 'hits'?
Any help appreciated
All the best
Shaun
I've modified add.cgi to use a unique identifier tag 'Rcpt' (passed as add.cgi?Rcpt=xxxxxx) to put in field 'rcpt' and it works fine, but I've found that someone can go back and re-use the form to submit another entry with the same rcpt reference - I don't want that.
I'd like add.cgi to check the currect links database for 'rcpt' and report an error if it finds and existing entry with the same rcpt reference (this is to stop them using the form for more than one submission.)
I've setup the error reporting and checking for the presence of 'rcpt', so now I just need a code snippet to check the links.
In my v1.13 I have the duplicate URL check that uses $db->query and $db->hits to establish if the input for 'URL' exists, but it doesn't appear to work the same for 2.x
Here's what I'm using:
Code:
# Check for duplicate rcpt in links my $chk_rcp = $db->query ( { rcpt => $IN->param('rcpt') } );
if ($chk_rcp) {
print $IN->header();
print Links::SiteHTML::display('error', { error => Links::language('DUP_RCPT')});
exit;
}
Firstly, have I got the query right?
Secondly, how would I check for 'hits'?
Any help appreciated
All the best
Shaun