Hi. I am trying to write a script which tells you if your referer was from a valie list. I want to be able to put;
$referer = $ENV{HTTP_REFERER};
$refer_url = "http://www.somesite.com";
if ($referer ne "$refer_url") { &bad } else { &print_good };
The problem is the page refering it may be from something like http://www.somesite.com/main.html, which obviously won't work. Is there a way i can parse just the $ENV{HTTP_REFERER} value to be just the domain name?
Any helpis much appreciated.
(As you can tell i'm not much of a perl guru, just teaching myself!)
Thanks
Andy
$referer = $ENV{HTTP_REFERER};
$refer_url = "http://www.somesite.com";
if ($referer ne "$refer_url") { &bad } else { &print_good };
The problem is the page refering it may be from something like http://www.somesite.com/main.html, which obviously won't work. Is there a way i can parse just the $ENV{HTTP_REFERER} value to be just the domain name?
Any helpis much appreciated.
(As you can tell i'm not much of a perl guru, just teaching myself!)
Thanks
Andy