X-Git-Url: https://git.jankratochvil.net/?p=www.jankratochvil.net.git;a=blobdiff_plain;f=project%2Fcaptive%2FIndex.html.pl;fp=project%2Fcaptive%2FIndex.html.pl;h=a137b4dae78cb06c3d1a553755100a5ebaca1a58;hp=13b660edac3f7a25c1a34f77be966785c1bb18f0;hb=8b7102f457714ff880702a3d9e253dfed57b1f3b;hpb=ac7d457b55283e13142c898795f048bd1e0c29e8 diff --git a/project/captive/Index.html.pl b/project/captive/Index.html.pl index 13b660e..a137b4d 100755 --- a/project/captive/Index.html.pl +++ b/project/captive/Index.html.pl @@ -31,6 +31,25 @@ Wuse 'My::Project'; Wuse 'project::captive::ListItem'; +# Redirect foreign visitors to our root with that disgusting introduction ad. +{ + my $r=Apache->request(); + if (my $referer=$r->header_in("Referer")) { + Wuse 'WebConfig'; + require URI; + my $refuri=URI->new_abs($referer,$r->uri()); + if (1 + && $refuri->host() ne "localhost" + && $refuri->host() ne &{$WebConfig::WebConfig{"web_hostname_sub"}}) { + use Apache::Constants qw(REDIRECT); + $r->status(REDIRECT); + $r->header_out("Location"=>"http://".&{$WebConfig::WebConfig{"web_hostname_sub"}}()); + exit 0; + } + } + } + + my $W=My::Project->init_project( "__PACKAGE__"=>__PACKAGE__, "ListItem"=>\@project::captive::ListItem::ListItem,