SPUG: Intermediate Link

William Julien moonbeam at catmanor.com
Mon Jul 8 18:42:03 CDT 2002

>Rather than just linking to http://www.Destination.Com/xyz.html, there
>are times when I want to embed the following hyperlink into a web page:
>When a visitor clicks on the link above, it would go to the abc.pl
>script on MyDomain.Com. An intermediate web page (with a modifiable
>message) would then display something like:
>--- Begin
>"You are leaving the xxxxxxxx web site. The privacy policy at the
>destination web site will differ. Click below to visit that site:
>--- End
>Could someone please post the _short_ Perl source code, or a URL which
>would specialize in this type of Perl script?
>Chuck Langenberg

A minimal redirect would look something like this:

#!/usr/bin/perl -w
# a minimal page redirect

use strict;

my ($path,      # redirect path 
    $server,    # local server name

$server = defined  $ENV{"SERVER_NAME"} ? $ENV{"SERVER_NAME"} : "unknown";
$path = defined  $ENV{"PATH_INFO"} ? $ENV{"PATH_INFO"} : "unknown";

print <<PAGE;
Content-type: text/html

<title>$server redirect</title>
<meta http-equiv=refresh content="60;url=$path">
<div align="center">
<table width=400>
You are leaving the $server web site. The privacy policy at the
destination web site will differ. Click below to visit that site:
<a href="$path">$path</a> 


 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     POST TO: spug-list at pm.org       PROBLEMS: owner-spug-list at pm.org
      Subscriptions; Email to majordomo at pm.org:  ACTION  LIST  EMAIL
  Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
 For daily traffic, use spug-list for LIST ;  for weekly, spug-list-digest
     Seattle Perl Users Group (SPUG) Home Page: http://seattleperl.org

More information about the spug-list mailing list