I found a program in perl that will check the http_referer and now, I have no idea where in HTML I would call this perl program, that would denie any one to get into the page, who doesn't have the right or no http_referer.
Here is the code
#!/usr/bin/perl
@referers=("www.something.com","something1.com");
&check_url;
# Return HTML Page or Redirect User
&return_html;
sub check_url {
# Localize the check_referer flag which determines if user is valid.
local($check_referer) = 0;
# If a referring URL was specified, for each valid referer, make sure
# that a valid referring URL was passed to .
if ($ENV{'HTTP_REFERER'}) {
foreach $referer (@referers) {
if ($ENV{'HTTP_REFERER'} =~ m¦https?://([^/]*)$referer¦i) {
$check_referer = 1;
last;
}
}
}
else {
$check_referer = 1;
}
# If the HTTP_REFERER was invalid, send back an error.
# It is possible that the referrer variable was simply not available for a variety of reasons.
if ($check_referer!= 1) {
print "Bad Referrer - Merchant should put in code to write to a log or mail themselves a
note to verify order was billed in something.com system"; }
}
***********************
What would be the code in HTML and where and is anything missing in my program?
Thank you for your help.
Suzi
suzi@stmdesigning.com
<!--#if expr="${HTTP_REFERER} != /^http://www.example.com/path/filename.ext$/" -->
<p>Bad Referrer - Merchant should put in code to write to a log or mail themselves a note to verify order was billed in something.com system</p>
<!--#endif --><!--#if expr="${HTTP_REFERER} = /^http://www.example.com/path/filename.ext$/" -->
<p>Good Referrer</p>
insert additional html here...
<!--#endif -->
I have no idea where in HTML I would call this perl program
I strongly recommend to read a little bit about CGI before trying this, because it's not as simple as HTML. Perhaps PHP is an alternative, which would IMO be easier to learn.