Gossamer Forum
Home : Products : DBMan : Customization :

New Code

Quote Reply
New Code
Howdy Folks...below is some new code that will prevent people from posting to your Dbman database from sites other than your own...

place this line in default.cfg
change URLs to your own

@okaydomains=("http://www.canadacentre.com", "http://canadacentre.com");

place this code in db.cgi


&valid_page;

sub valid_page
{
if (@okaydomains == 0) {return;}
$DOMAIN_OK=0;
$RF=$ENV{'HTTP_REFERER'};
$RF=~tr/A-Z/a-z/;
foreach $ts (@okaydomains)
{
if ($RF =~ /$ts/)
{ $DOMAIN_OK=1; }
}
if ( $DOMAIN_OK == 0)
{ print "Content-type: text/html\n\n Sorry, you can only add postings from the Canada Centre website. http://canadacentre.com";
exit;
}
}

hope this is helpful...Rob
Quote Reply
Re: New Code In reply to
Great! Thanks Rob.

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