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:
>  
>http://www.MyDomain.Com/cgi-bin/abc.pl?http://www.Destination.Com/xyz.html
>  
>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:
>http://www.Destination.Com/xyz.html"
>--- End
>  
>Could someone please post the _short_ Perl source code, or a URL which
>would specialize in this type of Perl script?
>  
>Regards,
>Chuck Langenberg
>http://www.Chuck.Langenberg.Com/

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

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
<title>$server redirect</title>
<meta http-equiv=refresh content="60;url=$path">
</head>
<body>
<div align="center">
<table width=400>
<tr>
<td>
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> 
</td>
</tr>
</table>
</body>
</html>
PAGE

---
William

 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
     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