...

View Full Version : Framing Program Help



danJenkins
09-04-2002, 04:59 AM
Alright, I got another script here, originally I wrote it for a friend of
mine, but now I want to expand on it. Originally it would run as
http://www.www.com/framer.cgi?http://www.newsite.com And that new site would run in a frame with whatever frames you selected through the script. But when someone goes straight to framer.cgi it will bring up a a blank frame for where the $ENV/Query_String should have called a page. I've been able to fix it to the point that, But I want to be able to go a little further with it,in that if nothing is in the $ENV/Query_String it will load a full page and not my frames. The script is below if you would like to take a look, any and
all help is appreciated...
Thanks,
Dan

----

#!/usr/bin/perl
use CGI;
$query = new CGI;
BEGIN {
open (STDERR, ">>/home/ringpla/public_html/cgi-bin/error1.txt");
}
#######################################################
$version = "1.0";
$size = "61";
$title = "Website Title";
$page = "http://www.www.com/adframe.shtml";
$missingfilesdir = "/home/public_html/text";
$basedir = "/home/ringpla/public_html/text
$missing = "default";
#######################################################
if ( ($ENV{'QUERY_STRING'} eq "") || (!(-e "$basedir/$ENV
{'QUERY_STRING'}")) )
{
$URL = "$missingfilesdir/$missing";
}else{
$URL = "$basedir/$ENV{'QUERY_STRING'}";
}

print "Content-type: text/html\n\n";
print <<EndHTML;
<html>
<head><title>$title</title></head>
<noframes>
<body>
Your browser doesn't support frames. Please click <a href="$URL">here</a> to
be redirected to the new page.
</body>
</noframes>

<frameset framespacing="0" rows="$size,*" frameborder="0" noresize>
<frame name="top" src="$page" target="top" scrolling="no">
<frame name="main" src="$URL" target="main">
</frameset>
</html>

EndHTML
;

chrisvmarle
09-04-2002, 06:34 AM
I didn't have time to test it, but try this:

#!/usr/bin/perl
use CGI;
$query = new CGI;
BEGIN {
open (STDERR, ">>/home/ringpla/public_html/cgi-bin/error1.txt");
}
##################################################
#####
$version = "1.0";
$size = "61";
$title = "Website Title";
$page = "http://www.www.com/adframe.shtml";
$missingfilesdir = "/home/public_html/text";
$basedir = "/home/ringpla/public_html/text
$missing = "default";
##################################################
#####
if ( ($ENV{'QUERY_STRING'} eq "") || (!(-e "$basedir/$ENV
{'QUERY_STRING'}")) )
{
$URL = "$missingfilesdir/$missing";
$missing=1;
}else{
$URL = "$basedir/$ENV{'QUERY_STRING'}";
}

if (!$missing) {
print "Content-type: text/html\n\n";
print <<EndHTML;
<html>
<head><title>$title</title></head>
<noframes>
<body>
Your browser doesn't support frames. Please click <a href="$URL">here</a> to
be redirected to the new page.
</body>
</noframes>

<frameset framespacing="0" rows="$size,*" frameborder="0" noresize>
<frame name="top" src="$page" target="top" scrolling="no">
<frame name="main" src="$URL" target="main">
</frameset>
</html>

EndHTML
;
} else {
print "location: $URL\n\n";
}

Mzzl, Chris

Inci
09-07-2002, 12:46 AM
Hello,

the first thing i noted - you have not closed defining
$basedir = "/home/ringpla/public_html/text
by ";

so it will $basedir = "/home/ringpla/public_html/text";

second thing i noted:

EndHTML
;

is incorrect - why we place ; here? perl will tell us a many surprising warnings so we must remove ';' from here.


hopefully it will work now.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum