Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Sep 2002
    Location
    Toronto, Ontario
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Framing Program Help

    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
    ;

  • #2
    Regular Coder
    Join Date
    Jun 2002
    Location
    the Netherlands
    Posts
    215
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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

  • #3
    New Coder
    Join Date
    Aug 2002
    Location
    Moscow, RU
    Posts
    23
    Thanks
    0
    Thanked 1 Time in 1 Post
    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.
    Last edited by Inci; 09-07-2002 at 01:03 AM.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •