in reply to http referers, if, else and failures
try using grep and lc and test for equality
#!/usr/local/bin/perl -w use strict; my @referers = qw| https://www.imdb.com http://www.yoda-speak.org |; $ENV{HTTP_REFERER} = 'http://www.yoda-speak.org'; print check_url($ENV{HTTP_REFERER},@referers) , "\n"; $ENV{HTTP_REFERER} = 'https://www.imdb.com'; print check_url($ENV{HTTP_REFERER},@referers) , "\n"; $ENV{HTTP_REFERER} = 'http://badsite.net'; print check_url($ENV{HTTP_REFERER},@referers) , "\n"; sub check_url { my $http_referer = shift; my @referers = @_; return scalar(grep ( lc($http_referer) eq lc($_) , @referers )); }
| Mynd you, mønk bites Kan be pretti nasti... |
|
|---|