in reply to AuthorizedDomain script?
Let me re-write it using some Perl Best Practices:
use strict; use warnings; # Just the domain name, no "www." my $AuthorizedDomain = lc 'example.com'; my $FormDomain = lc $ENV{'HTTP_REFERER'}; $FormDomain =~ s{ \A https?:// # Strip off the protocol (?:www\.)? # Strip off any "www." (.*?) # Grab everything before... / # The first slash .* # And delete the rest \Z } { $1 }msx; if ($FormDomain ne $AuthorizedDomain) { ErrorHTML('Unauthorized access.'); }
Of course, for this to really work, the ErrorHTML function would have to be defined somewhere.
Update: Removed #5. Thanks, Your Mother.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: AuthorizedDomain script?
by Your Mother (Archbishop) on Jul 08, 2009 at 17:40 UTC |