Need script

They have: 13 posts

Joined: Apr 2000

Hi,
I am looking for a script that displays a top frame when visitors click out (via a link) from your site - does anyone know of any?
Chris Irving

Vincent Puglia's picture

They have: 634 posts

Joined: Dec 1999

Hi Chris,

I may be way offbase here, but...
Do you mean something like:

You can try to implement it in javascript, but it's a bad idea for 2 reasons:

1) the onUnload doesn't always fire
2) many people object to being held hostage.

Smiling
Vinny

Where the world once stood
the blades of grass cut me still

mjames's picture

They have: 2,064 posts

Joined: Dec 1999

I don't recommend using the frames like that (or really any way at all!)... it will annoy your users and when they are annoyed, are they going to want to come back? I think not.

They have: 568 posts

Joined: Nov 1999

you going to pay for it?

They have: 850 posts

Joined: Jul 1999

Hello.

I hope the code below is what your looking for. I have tested it and it ran fine.

#!/usr/bin/perl
#Variables
$error_url = 'http://mainsite'; #URL if there an error occurs
$top_url = 'http://www.mainsite.com/topframe.html'; #URL to the top frame
$html_title = 'Link'; #title of framed page



#Parsing any input
&parse;


if($ENV{'QUERY_STRING'})
{
#a url is in the $query string, go on with script
print "Content-type:text/html\n\n";
print qq|
<html><head><title>$html_title</title></head>
<frameset framespacing="0" border="0" frameborder="0" rows="5%,95%">
<frame scrolling="no" noresize src="$top_url" marginwidth="1" marginheight="1">
        <frame src="$ENV{'QUERY_STRING'}" scrolling="auto" marginwidth="1" marginheight="1" noresize>
</frameset>
<html>
|;
exit;

}
else
{
#error occured,probably no url entered, redirecting user to $error_url
print "Location: $error_url\nURI: $error_url\n\n";
exit;
}


sub parse {

(*fval) = @_ if @_ ;

local ($buf);
if ($ENV{'REQUEST_METHOD'} eq 'POST') {
read(STDIN,$buf,$ENV{'CONTENT_LENGTH'});
}
else {
$buf=$ENV{'QUERY_STRING'};
}
if ($buf eq "") {
return 0 ;
}
else {
@fval=split(/&/,$buf);
foreach $i (0 .. $#fval){
($name,$val)=split (/=/,$fval[$i],2);
$val=~tr/+/ /;
$val=~ s/%(..)/pack("c",hex($1))/ge;
$name=~tr/+/ /;
$name=~ s/%(..)/pack("c",hex($1))/ge;

if (!defined($field{$name})) {
$field{$name}=$val;
}
else {
$field{$name} .= ",$val";

}


   }
}
return 1;
}
'

Just link your sites to
domain.com/cgi-bin/scriptname.cgi?http://link_here

This will than create a frame in which the specified top frame appears, and the link is placed below it.

Hope that helps

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.