#!/usr/bin/perl -w # ---------------------------------------------------------------------------- # FrameIt 5.13a (01/17/2000) # Copyright (c) 1999 Jason M. Hinkle. All rights reserved. This program is # free software; you may redistribute it and/or modify it under the same # terms as Perl itself. # For more information see: http://www.verysimple.com/scripts/ # # LEGAL DISCLAIMER: # This software is provided as-is. Use it at your own risk. The # author takes no responsibility for any damages or losses directly # or indirectly caused by this software. # @@@@ # (o o) # -------------------------------------------------------oOOo-(_)-oOOo-------- ############################################################################## # CONFIGURATION VARIABLES # # DO NOT EDIT THIS VARIABLE UNLESS YOU HAVE MOVED OR RENAMED THE CONFIGURATION # FILE, OR YOU ARE GETTING A "CONFIG FILE NOT FOUND" ERROR!!! THE SCRIPT WILL # BE ABLE TO SET THIS VARIABLE AUTOMATICALLY AS LONG AS THE CONFIG FILE IS IN # THE SAME DIRECTORY AS THE SCRIPT. my $configFilePath = ""; # # END OF CONFIGURATION VARIABLES ############################################################################## ## this is supposed to exit gracefully if the mod can't be found. ## BEGIN supposedly compiles before anything else. eval supposedly ## makes the script keep going. it don't work. BEGIN { # include current directory in module search path push(@INC,`pwd`); # Import supporting libraries eval { use strict; use CGI; require 5.000; # use CGI::Request; # alternative - see object initialization below too }; &FatalError($@) if ($@); } # Flush the Perl buffer $|++; # Create new CGI object to parse the input from the browser my $objBrowser = new CGI; # my $objBrowser = new CGI::Request; # alternative - see "use" above # Set debugmode to 1 to check for configuration problems: my $debugMode = $objBrowser->param('Debug') || $objBrowser->param('Debug'); # Set the configFilePath unless it has been specifically assigned above. # This routine should work for both UNIX and NT servers. $configFilePath = &CurrentDirectory . "FrameIt.cfg" unless ($configFilePath); # Create the FrameIt object or die if not successful: my $objFrameIt = FrameIt->new($configFilePath,$debugMode); &FatalError("config file could not be read") unless ($objFrameIt); if ($objBrowser->param('footer')) { # the footer is always called by the script, so we have to override HTTP_REFERER $objFrameIt->ReferringUrl($objBrowser->param('referringUrl')) if ($objBrowser->param('referringUrl')); } # BACKWARDS COMPATIBILITY: check for FrameIt 4.1 and earlier variables: my $url = $objBrowser->param('Url') || $objBrowser->param('url'); my $text = $objBrowser->param('Text') || $objBrowser->param('text'); my $title = $objBrowser->param('Title') || $objBrowser->param('title'); my $link = $objBrowser->param('Link') || $objBrowser->param('override_link'); my $footerUrl = $objBrowser->param('FooterUrl') || $objBrowser->param('override_footer'); my $footerSize = $objBrowser->param('FooterSize') || $objBrowser->param('footer_frame_size'); my $linkTarget = $objBrowser->param('LinkTarget') || $objBrowser->param('parent_frame'); if (defined($objBrowser->param('remove'))) { my $removeFrame = "1" if ($objBrowser->param('remove') eq "YES" || $objBrowser->param('remove') eq "yes"); } my $removeFrame = $objBrowser->param('ShowRemoveFrame') if ($objBrowser->param('ShowRemoveFrame')); # Load alternate config file if requested $objFrameIt->ConfigFile($objBrowser->param('ConfigFile')) if ($objBrowser->param('ConfigFile')); # Set the FrameIt properties. These are needed by both the body and footer frame $objFrameIt->AdText($objBrowser->param('AdText')) if ($objBrowser->param('AdText')); $objFrameIt->AdUrl($objBrowser->param('AdUrl')) if ($objBrowser->param('AdUrl')); $objFrameIt->BodyFrame($objBrowser->param('BodyFrame')) if ($objBrowser->param('BodyFrame')); $objFrameIt->FooterBackground($objBrowser->param('FooterBackground')) if ($objBrowser->param('FooterBackground')); $objFrameIt->FooterBgcolor($objBrowser->param('FooterBgcolor')) if ($objBrowser->param('FooterBgcolor')); $objFrameIt->FooterFontFace($objBrowser->param('FooterFontFace')) if ($objBrowser->param('FooterFontFace')); $objFrameIt->FooterFontSize($objBrowser->param('FooterFontSize')) if ($objBrowser->param('FooterFontSize')); $objFrameIt->FooterFrame($objBrowser->param('FooterFrame')) if ($objBrowser->param('FooterFrame')); $objFrameIt->FooterTextColor($objBrowser->param('FooterTextColor')) if ($objBrowser->param('FooterTextColor')); $objFrameIt->FooterTextStyle($objBrowser->param('FooterTextStyle')) if ($objBrowser->param('FooterTextStyle')); $objFrameIt->Link($link) if ($link); $objFrameIt->LinkTarget($linkTarget) if ($linkTarget); $objFrameIt->ShowRemoveFrame($removeFrame) if ($removeFrame); $objFrameIt->ShowAd($objBrowser->param('ShowAd')) if ($objBrowser->param('ShowAd')); $objFrameIt->Text($text) if ($text); $objFrameIt->Url($url) if ($url); # Determine if we are outputting the Default, ShowCode, FrameSet or # the Footer and set the properties that are needed for that particular task: if ($url) { if ($objBrowser->param('footer')) { $objFrameIt->OutputFooterFrame(); } else { # These properties are not needed by the footer frame: $objFrameIt->AllowResize($objBrowser->param('AllowResize')) if ($objBrowser->param('AllowResize')); $objFrameIt->FrameBorder($objBrowser->param('FrameBorder')) if ($objBrowser->param('FrameBorder')); $objFrameIt->FooterLocation($objBrowser->param('FooterLocation')) if ($objBrowser->param('FooterLocation')); $objFrameIt->FooterSize($footerSize) if ($footerSize); $objFrameIt->FooterUrl($footerUrl) if ($footerUrl); $objFrameIt->Title($title) if ($title); $objFrameIt->TextForLink($objBrowser->param('TextForLink')) if ($objBrowser->param('TextForLink')); # output either the frameset or the code $objFrameIt->OutputCode() if ($objBrowser->param('outputCode')); $objFrameIt->OutputFrameset() unless ($objBrowser->param('outputCode')); } } else { $objFrameIt->OutputDefault(); } print "\nFrameIt exited normally\n\n" if ($debugMode); exit; # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub CurrentDirectory { # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ my ($pathToScript,$position) = ""; if ($ENV{'PATH_TRANSLATED'}) { $pathToScript = $ENV{'PATH_TRANSLATED'}; $position = rindex ($pathToScript,'\\'); } else { $pathToScript = $ENV{'SCRIPT_FILENAME'}; $position = rindex ($pathToScript,'/'); } my $currentDir = substr ($pathToScript,0,$position + 1); return $currentDir; } # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub FatalError { # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # this error can occur when the object could not be created, so # we can't call any methods or properties. my $errorNumber = shift; print "Content-type: text/html\n\n"; print "\n"; print "\n"; print "FrameIt.cgi Fatal Error\n"; print "\n"; print "\n"; print "
\n"; print "FrameIt 5.13a
\n"; print "Advanced Link Redirector\n"; print "
\n"; print "

\n"; print "Fatal Error: " . $errorNumber . "\n"; print "

\n"; print "This script has encountered an error. Please use the \"back\" button\n"; print "on your browser to return to the previous page and try again.\n"; print "If you continue to have problems, please contact the webmaster. \n"; print "

\n"; print "If you are the webmaster, please use the FrameIt debug mode to \n"; print "locate the error. \n"; print "


\n"; print "\n"; print "\n"; exit; } # ---------------------------------------------------------------------------- # FrameIt Module 5.01.03 # Copyright (c) 1999 Jason M. Hinkle. All rights reserved. This module is # free software; you may redistribute it and/or modify it under the same # terms as Perl itself. # For more information see: http://www.verysimple.com/scripts/ # # LEGAL DISCLAIMER: # This software is provided as-is. Use it at your own risk. The # author takes no responsibility for any damages or losses directly # or indirectly caused by this software. # ---------------------------------------------------------------------------- package FrameIt; require 5.000; my $ID =q( $Id: FrameIt.pm,v 5.13a 2000/01/17 17:00:00 sdowd Exp $ ); my $VERSION = "5.13a"; =head1 NAME FrameIt.pm - Perl 5 module to power FrameIt.cgi =head1 SYNOPSIS push(@INC,'pwd'); # (includes current directory in module search path) use FrameIt; =head1 DESCRIPTION This module provides an object oriented interface for FrameIt.cgi. No user serviceable parts inside! =head1 USAGE Here is a basic example script: #!/usr/bin/perl # Import the supporting libraries: push(@INC,'pwd'); use FrameIt; $configFilePath = "/home/www/FrameIt.cfg"; # Create and use the FrameIt object: $objFrameIt = FrameIt->new($configFilePath); $objFrameIt->OutputFrameset(); Refer to http://www.verysimple.com/scripts/ for more information. =head1 AUTHOR Jason M. Hinkle =head1 COPYRIGHT Copyright (c) 1999 Jason M. Hinkle. All rights reserved. This module is free software; you can redistribute it and/or modify it under the same terms as Perl itself. =head1 CREDITS Props to WWW.CPAN.ORG =cut # Set Globals my %configFileVariables; # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub new { # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ my $class = shift; my $configFile = shift || "./FrameIt.cfg"; my $debugMode = shift; my $httpReferer = $ENV{'HTTP_REFERER'} || "http://no.referring.url/"; my $httpUserAgent = $ENV{'HTTP_USER_AGENT'} || "NoUserAgent"; my $httpRemoteHost = $ENV{'REMOTE_HOST'} || "0.0.0.0"; print "Content-type: text/plain\n\n" if ($debugMode); print "FrameIt->new (Debug Mode)\n" if ($debugMode); my $this = { _ConfigFile => $configFile, _DebugMode => $debugMode, _LogHost => $httpRemoteHost, _LogReferrer => $httpReferer, _LogAgent => $httpUserAgent, ReferringUrl => $ENV{'HTTP_REFERER'}, ScriptUrl => $ENV{'SCRIPT_NAME'}, FooterUrl => $ENV{'SCRIPT_NAME'} . "?footer=1", LinkTarget => "_top", FooterBackground=> "", FooterBgcolor => "#ffffff", FooterTextColor => "#0000ff", FooterTextStyle => "", BodyFrame => "body", FooterFrame => "footer", Text => "Back", Link => $ENV{'HTTP_REFERER'}, FooterSize => "35", FooterFontSize => "2", FooterFontFace => "Arial,Helvetica", FooterLocation => "1", EnableLogging => "0", LogFilePath => "", RemoveFooter => "", ConfigFile => "", ShowRemoveFrame => "", ShowAd => "", AllowResize => "", FrameBorder => "", HideAdAuthorized=> "", Title => "", Url => "", }; bless $this; print "FrameIt->new sucessfully created new object\n" if ($debugMode); return 0 unless ($this->LoadConfigFile($configFile)); $this->{_IsAuthorized} = $this->_SetAuthorized(); $this->{_IsBanned} = $this->_SetBanned(); return $this; } # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub Version { # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ return "5.13a"; # To Do: Why is this not working? Variable out of scope? # return $VERSION; } # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub LoadConfigFile { # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ my $this = shift; my $configFile = shift; # Set ConfigFileVariables to avoid Uninitialized Variable Warnings $configFileVariables{'ConfigFile'} = "" unless defined($configFileVariables{'ConfigFile'}); $configFileVariables{'FooterFrame'} = "" unless defined($configFileVariables{'FooterFrame'}); $configFileVariables{'BodyFrame'} = "" unless defined($configFileVariables{'BodyFrame'}); $configFileVariables{'LinkTarget'} = "" unless defined($configFileVariables{'LinkTarget'}); $configFileVariables{'AllowResize'} = "" unless defined($configFileVariables{'AllowResize'}); $configFileVariables{'FrameBorder'} = "" unless defined($configFileVariables{'FrameBorder'}); $configFileVariables{'ShowAd'} = "" unless defined($configFileVariables{'ShowAd'}); $configFileVariables{'HideAdAuthorized'} = "" unless defined($configFileVariables{'HideAdAuthorized'}); $configFileVariables{'AdText'} = "" unless defined($configFileVariables{'AdText'}); $configFileVariables{'AdUrl'} = "" unless defined($configFileVariables{'AdUrl'}); $configFileVariables{'Title'} = "" unless defined($configFileVariables{'Title'}); $configFileVariables{'Url'} = "" unless defined($configFileVariables{'Url'}); $configFileVariables{'Text'} = "" unless defined($configFileVariables{'Text'}); $configFileVariables{'Link'} = "" unless defined($configFileVariables{'Link'}); $configFileVariables{'FooterSize'} = "" unless defined($configFileVariables{'FooterSize'}); $configFileVariables{'FooterBgColor'} = "" unless defined($configFileVariables{'FooterBgColor'}); $configFileVariables{'FooterBackground'} = "" unless defined($configFileVariables{'FooterBackground'}); $configFileVariables{'FooterTextColor'} = "" unless defined($configFileVariables{'FooterTextColor'}); $configFileVariables{'FooterTextStyle'} = "" unless defined($configFileVariables{'FooterTextStyle'}); $configFileVariables{'FooterFontFace'} = "" unless defined($configFileVariables{'FooterFontFace'}); $configFileVariables{'FooterFontSize'} = "" unless defined($configFileVariables{'FooterFontSize'}); $configFileVariables{'FooterLocation'} = "" unless defined($configFileVariables{'FooterLocation'}); $configFileVariables{'ShowRemoveFrame'} = "" unless defined($configFileVariables{'ShowRemoveFrame'}); $configFileVariables{'FooterUrl'} = "" unless defined($configFileVariables{'FooterUrl'}); my $allowSecurityChange = 1 if ($configFile eq $this->{_ConfigFile}); unless (-r $configFile) { print "FrameIt->LoadConfigFile unable to read config file: " . $configFile . "\n" if ($this->{_DebugMode}); $this->CrashAndBurn("LoadConfigFile couldn't read: $configFile") if ($this->{_ShowWarnings} && !$allowSecurityChange); return 0; } print "FrameIt->LoadConfigFile loading config file: " . $configFile . "\n" if ($this->{_DebugMode}); open(CONFIG, "$configFile"); my @configFile = ; close(CONFIG); print "{" . "\n" if ($this->{_DebugMode}); my $configLine; my $configComment; my $configKey; my $configValue; foreach $configLine (@configFile) { # check for null value to avoid "uninitialized variable" warning if (defined($configLine)) { # check for null value chop $configLine; # remove the line break if ($configLine) { # check for blank line ($configLine, $configComment) = split(/[\t ]*#[\t ]*/,$configLine); # remove comments if ($configLine) { # check for comment only ($configKey, $configValue) = split(/[\t ]*=[\t ]*/,$configLine); # split key/value if (defined($configValue)) { # check for key with no value # remove all the trailing spaces from value if necessary: while ( substr($configValue, (length($configValue) -1), 1) eq " ") { chop $configValue; } if (($configValue) || ($configValue="0")) { # check if value was just a bunch of spaces $configValue = "0" if $configValue eq "-1"; # security setting variables are denoted by _ as the first character. # do not allow alternate config files to change these: unless (substr($configKey,0,1) eq "_" && !$allowSecurityChange) { print " SET: " . $configKey . " = \"" . $configValue . "\"\n" if ($this->{_DebugMode}); $this->{$configKey} = $configValue; $configFileVariables{$configKey} = $configValue; } else { print " IGNORED: " . $configKey . " = \"" . $configValue . "\"\n" if ($this->{_DebugMode}); } } # value is spaces } # key with no value } # comment only } # blank line } # null } print "}" . "\n" if ($this->{_DebugMode}); return 1; } # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub Title { # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ my $name = "Title"; my $this = shift; my $newValue = shift; unless ($newValue) { print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode}); return $this->{$name}; } $this->{$name} = $newValue; print "FrameIt->" . $name . " set to: " . $newValue . "\n" if ($this->{_DebugMode}); return 1; } # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub TextForLink { # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ my $name = "TextForLink"; my $this = shift; my $newValue = shift; unless ($newValue) { print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode}); return $this->{$name}; } $this->{$name} = $newValue; print "FrameIt->" . $name . " set to: " . $newValue . "\n" if ($this->{_DebugMode}); return 1; } # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub ConfigFile { # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ my $name = "ConfigFile"; my $this = shift; my $newValue = shift; unless ($newValue) { print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode}); return $this->{$name}; } if ($this->{_RestrictUnauthorizedDomains} && !$this->{_IsAuthorized}) { # Restrict the usage of this script print "FrameIt->" . $name . " not authorized to set to: " . $newValue . "\n" if ($this->{_DebugMode}); $this->CrashAndBurn("Only Authorized Domains may override " . $name) if ($this->{_ShowWarnings}); } else { $this->{$name} = $newValue; print "FrameIt->" . $name . " set to: " . $newValue . "\n" if ($this->{_DebugMode}); $this->LoadConfigFile($newValue); } return 1; } # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub Url { # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ my $name = "Url"; my $this = shift; my $newValue = shift; unless ($newValue) { print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode}); return $this->{$name}; } $this->{$name} = $newValue; print "FrameIt->" . $name . " set to: " . $newValue . "\n" if ($this->{_DebugMode}); return 1; } # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub EnableLogging { # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ my $name = "EnableLogging"; my $this = shift; my $newValue = shift; unless ($newValue) { print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode}); return $this->{$name}; } $this->{$name} = $newValue; print "FrameIt->" . $name . " set to: " . $newValue . "\n" if ($this->{_DebugMode}); return 1; } # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub LogFilePath { # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ my $name = "LogFilePath"; my $this = shift; my $newValue = shift; unless ($newValue) { print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode}); return $this->{$name}; } $this->{$name} = $newValue; print "FrameIt->" . $name . " set to: " . $newValue . "\n" if ($this->{_DebugMode}); return 1; } # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub AllowResize { # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ my $name = "AllowResize"; my $this = shift; my $newValue = shift; unless ($newValue) { print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode}); return $this->{$name}; } if ($newValue eq "1") { $this->{$name} = "1"; print "FrameIt->" . $name . " set to: 1\n" if ($this->{_DebugMode}); } else { $this->{$name} = "0"; print "FrameIt->" . $name . " set to: 0\n" if ($this->{_DebugMode}); } return 1; } # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub FrameBorder { # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ my $name = "FrameBorder"; my $this = shift; my $newValue = shift; unless (defined($newValue)) { print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode}); return $this->{$name}; } if ($newValue eq "1") { $this->{$name} = "1"; print "FrameIt->" . $name . " set to: 1\n" if ($this->{_DebugMode}); } else { $this->{$name} = "0"; print "FrameIt->" . $name . " set to: 0\n" if ($this->{_DebugMode}); } return 1; } # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub ReferringUrl { # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ my $name = "ReferringUrl"; my $this = shift; my $newValue = shift; unless ($newValue) { print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode}); return $this->{$name}; } $this->{$name} = $newValue; print "FrameIt->" . $name . " set to: " . $newValue . "\n" if ($this->{_DebugMode}); return 1; } # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub BodyFrame { # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ my $name = "BodyFrame"; my $this = shift; my $newValue = shift; unless ($newValue) { print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode}); return $this->{$name}; } $this->{$name} = $newValue; print "FrameIt->" . $name . " set to: " . $newValue . "\n" if ($this->{_DebugMode}); return 1; } # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub FooterFrame { # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ my $name = "FooterFrame"; my $this = shift; my $newValue = shift; unless ($newValue) { print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode}); return $this->{$name}; } $this->{$name} = $newValue; print "FrameIt->" . $name . " set to: " . $newValue . "\n" if ($this->{_DebugMode}); return 1; } # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub FooterSize { # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ my $name = "FooterSize"; my $this = shift; my $newValue = shift; unless ($newValue) { print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode}); return $this->{$name}; } if ($this->{_RestrictUnauthorizedDomains} && !$this->{_IsAuthorized}) { # Restrict the usage of this script print "FrameIt->" . $name . " not authorized to set to: " . $newValue . "\n" if ($this->{_DebugMode}); $this->CrashAndBurn("Only Authorized Domains may override " . $name) if ($this->{_ShowWarnings}); } else { $this->{$name} = $newValue; print "FrameIt->" . $name . " set to: " . $newValue . "\n" if ($this->{_DebugMode}); } return 1; } # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub FooterUrl { # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ my $name = "FooterUrl"; my $this = shift; my $newValue = shift; unless ($newValue) { print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode}); return $this->{$name}; } if ($this->{_RestrictUnauthorizedDomains} && !$this->{_IsAuthorized}) { # Restrict the usage of this script print "FrameIt->" . $name . " not authorized to set to: " . $newValue . "\n" if ($this->{_DebugMode}); $this->CrashAndBurn("Only Authorized Domains may override " . $name) if ($this->{_ShowWarnings}); } else { $this->{$name} = $newValue; print "FrameIt->" . $name . " set to: " . $newValue . "\n" if ($this->{_DebugMode}); } return 1; } # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub ScriptUrl { # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ my $name = "ScriptUrl"; my $this = shift; my $newValue = shift; unless ($newValue) { print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode}); return $this->{$name}; } $this->{$name} = $newValue; print "FrameIt->" . $name . " set to: " . $newValue . "\n" if ($this->{_DebugMode}); return 1; } # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub LinkTarget { # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ my $name = "LinkTarget"; my $this = shift; my $newValue = shift; unless ($newValue) { print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode}); return $this->{$name}; } $this->{$name} = $newValue; print "FrameIt->" . $name . " set to: " . $newValue . "\n" if ($this->{_DebugMode}); return 1; } # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub Text { # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ my $name = "Text"; my $this = shift; my $newValue = shift; unless ($newValue) { my ($tempValue) = $this->{$name}; if (substr ($tempValue,0,4) eq "http") { $tempValue = ""; } print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode}); return $tempValue; } $this->{$name} = substr($newValue,0,60); print "FrameIt->" . $name . " set to: " . $newValue . "\n" if ($this->{_DebugMode}); return 1; } # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub Link { # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ my $name = "Link"; my $this = shift; my $newValue = shift; unless ($newValue) { print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode}); return $this->{$name}; } $this->{$name} = $newValue; print "FrameIt->" . $name . " set to: " . $newValue . "\n" if ($this->{_DebugMode}); return 1; } # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub FooterLocation { # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ my $name = "FooterLocation"; my $this = shift; my $newValue = shift; unless ($newValue) { print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode}); return $this->{$name}; } if ($this->{_RestrictUnauthorizedDomains} && !$this->{_IsAuthorized} && $newValue eq "3") { # Restrict the usage of this script print "FrameIt->" . $name . " not authorized to set to: " . $newValue . "\n" if ($this->{_DebugMode}); $this->CrashAndBurn("Only Authorized Domains may change " . $name . " to redirect") if ($this->{_ShowWarnings}); } else { $this->{$name} = $newValue; print "FrameIt->" . $name . " set to: " . $newValue . "\n" if ($this->{_DebugMode}); } return 1; } # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub FooterFontSize { # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ my $name = "FooterFontSize"; my $this = shift; my $newValue = shift; unless ($newValue) { print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode}); return $this->{$name}; } $this->{$name} = $newValue; print "FrameIt->" . $name . " set to: " . $newValue . "\n" if ($this->{_DebugMode}); return 1; } # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub FooterFontFace { # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ my $name = "FooterFontFace"; my $this = shift; my $newValue = shift; unless ($newValue) { print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode}); return $this->{$name}; } $this->{$name} = $newValue; print "FrameIt->" . $name . " set to: " . $newValue . "\n" if ($this->{_DebugMode}); return 1; } # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub ShowRemoveFrame { # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ my $name = "ShowRemoveFrame"; my $this = shift; my $newValue = shift; unless ($newValue) { print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode}); return $this->{$name}; } if ($newValue eq "1") { $this->{$name} = "1"; print "FrameIt->" . $name . " set to: 1\n" if ($this->{_DebugMode}); } else { $this->{$name} = ""; print "FrameIt->" . $name . " set to: 0\n" if ($this->{_DebugMode}); } return 1; } # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub ShowAd { # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ my $name = "ShowAd"; my $this = shift; my $newValue = shift; unless ($newValue) { print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode}); return $this->{$name}; } if ($this->{_RestrictUnauthorizedDomains} && !$this->{_IsAuthorized}) { # Restrict the usage of this script print "FrameIt->" . $name . " not authorized to set to: " . $newValue . "\n" if ($this->{_DebugMode}); $this->CrashAndBurn("Only Authorized Domains may override " . $name) if ($this->{_ShowWarnings}); } else { if ($newValue eq "1") { $this->{$name} = "1"; print "FrameIt->" . $name . " set to: 1\n" if ($this->{_DebugMode}); } else { $this->{$name} = ""; print "FrameIt->" . $name . " set to: 0\n" if ($this->{_DebugMode}); } } return 1; } # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub HideAdAuthorized { # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ my $name = "HideAdAuthorized"; my $this = shift; my $newValue = shift; unless ($newValue) { print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode}); return $this->{$name}; } if ($this->{_RestrictUnauthorizedDomains} && !$this->{_IsAuthorized}) { # Restrict the usage of this script print "FrameIt->" . $name . " not authorized to set to: " . $newValue . "\n" if ($this->{_DebugMode}); $this->CrashAndBurn("Only Authorized Domains may override " . $name) if ($this->{_ShowWarnings}); } else { if ($newValue eq "1") { $this->{$name} = "1"; print "FrameIt->" . $name . " set to: 1\n" if ($this->{_DebugMode}); } else { $this->{$name} = ""; print "FrameIt->" . $name . " set to: 0\n" if ($this->{_DebugMode}); } } return 1; } # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub AdText { # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ my $name = "AdText"; my $this = shift; my $newValue = shift; unless ($newValue) { my ($tempValue) = $this->{$name}; if (substr ($tempValue,0,4) eq "http") { $tempValue = ""; } print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode}); return $tempValue; } if ($this->{_RestrictUnauthorizedDomains} && !$this->{_IsAuthorized}) { # Restrict the usage of this script print "FrameIt->" . $name . " not authorized to set to: " . $newValue . "\n" if ($this->{_DebugMode}); $this->CrashAndBurn("Only Authorized Domains may override " . $name) if ($this->{_ShowWarnings}); } else { $this->{$name} = $newValue; print "FrameIt->" . $name . " set to: " . $newValue . "\n" if ($this->{_DebugMode}); } return 1; } # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub FooterBgcolor { # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ my $name = "FooterBgcolor"; my $this = shift; my $newValue = shift; unless ($newValue) { print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode}); return $this->{$name}; } $this->{$name} = $newValue; print "FrameIt->" . $name . " set to: " . $newValue . "\n" if ($this->{_DebugMode}); return 1; } # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub FooterBackground { # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ my $name = "FooterBackground"; my $this = shift; my $newValue = shift; unless ($newValue) { print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode}); return $this->{$name}; } $this->{$name} = $newValue; print "FrameIt->" . $name . " set to: " . $newValue . "\n" if ($this->{_DebugMode}); return 1; } # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub FooterTextColor { # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ my $name = "FooterTextColor"; my $this = shift; my $newValue = shift; unless ($newValue) { print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode}); return $this->{$name}; } $this->{$name} = $newValue; print "FrameIt->" . $name . " set to: " . $newValue . "\n" if ($this->{_DebugMode}); return 1; } # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub FooterTextStyle { # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ my $name = "FooterTextStyle"; my $this = shift; my $newValue = shift; unless ($newValue) { print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode}); return $this->{$name}; } $this->{$name} = $newValue; print "FrameIt->" . $name . " set to: " . $newValue . "\n" if ($this->{_DebugMode}); return 1; } # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub AdUrl { # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ my $name = "AdUrl"; my $this = shift; my $newValue = shift; unless ($newValue) { print "FrameIt->" . $name . " returned current value: " . $this->{$name} . "\n" if ($this->{_DebugMode}); return $this->{$name}; } if ($this->{_RestrictUnauthorizedDomains} && !$this->{_IsAuthorized}) { # Restrict the usage of this script print "FrameIt->" . $name . " not authorized to set to: " . $newValue . "\n" if ($this->{_DebugMode}); $this->CrashAndBurn("Only Authorized Domains may override " . $name) if ($this->{_ShowWarnings}); } else { $this->{$name} = $newValue; print "FrameIt->" . $name . " set to: " . $newValue . "\n" if ($this->{_DebugMode}); } return 1; } # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub OutputFrameset { # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # output the HTML headers my $this = shift; print "FrameIt->OutputFrameSet called (output below)\n\n" if ($this->{_DebugMode}); # If no referrer, display AdText instead of return link $this->{'Text'} = $this->{'AdText'} unless ($ENV{'HTTP_REFERER'}); $this->{'Link'} = $this->{'AdUrl'} unless ($ENV{'HTTP_REFERER'}); # Print error and exit if the domain is banned $this->CrashAndBurn($this->ReferringUrl . " has been banned from using this script.") if ($this->{_IsBanned}); if ($this->{_AllowOnlyAuthorizedDomains} && !$this->{_IsAuthorized}) { # Disallow Unauthorized Domain $this->CrashAndBurn($this->ReferringUrl . " is not authorized to use this script.") } # mess with the footer URL a bit $footerTempValue = $this->_UnPassThru($this->FooterUrl); $footerTempValue .= "?" unless ($footerTempValue =~ /\?/); # get variables ready to pass to the footer, since 0 can be confused as NULL my $showRemoveFrame = $this->ShowRemoveFrame() || "-1"; my $showAd = $this->ShowAd() || "-1"; # don't bother passing these variables if this is unauthorized domain. unless ($this->{_RestrictUnauthorizedDomains} && !$this->{_IsAuthorized}) { $footerTempValue .= "&ShowAd=" . $showAd; $footerTempValue .= "&AdText=" . $this->_PassThru($this->AdText); $footerTempValue .= "&AdUrl=" . $this->_PassThru($this->AdUrl); } $footerTempValue .= "&Url=" . $this->_PassThru($this->Url); $footerTempValue .= "&referringUrl=" . $this->ReferringUrl; $footerTempValue .= "&Link=" . $this->Link; $footerTempValue .= "&Text=" . $this->_PassThru($this->Text); $footerTempValue .= "&FooterFontFace=" . $this->FooterFontFace; $footerTempValue .= "&FooterFontSize=" . $this->FooterFontSize; $footerTempValue .= "&FooterBgcolor=" . $this->FooterBgcolor; $footerTempValue .= "&FooterBackground=" . $this->FooterBackground; $footerTempValue .= "&FooterTextColor=" . $this->FooterTextColor; $footerTempValue .= "&FooterTextStyle=" . $this->FooterTextStyle; $footerTempValue .= "&ShowRemoveFrame=" . $showRemoveFrame; $footerTempValue .= "&BodyFrame=" . $this->BodyFrame; $footerTempValue .= "&LinkTarget=" . $this->LinkTarget; # change FooterUrl manually instead of through the function/wrapper or else the # function will try to do a security check. This is probably not too slick. $this->{'FooterUrl'} = $footerTempValue; # replace any passed thru variables $this->Url($this->_UnPassThru($this->Url)); $this->Title($this->_UnPassThru($this->Title)); if ($this->FooterLocation eq "3") { print "Location: " . $this->Url . "\n\n"; return 1; } # set the text for frame resize my $resize = "noresize"; if ($this->AllowResize()) { $resize = ""; } # set the text for frame border my $frameborder = "no"; if ($this->FrameBorder()) { $frameborder = "yes"; } print "Content-type: text/html\n\n"; print "\n"; print "\n"; print "" . $this->Title . "\n"; print "\n"; if ($this->FooterLocation eq "2") { print "FooterSize . ",*\">\n"; print "FooterFrame . "\" src=\"" . $this->FooterUrl . "\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"auto\" frameborder=\"" . $frameborder . "\" " . $resize . ">\n"; print "BodyFrame . "\" src=\"" .$this->Url . "\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"auto\" frameborder=\"" . $frameborder . "\" " . $resize . ">\n"; } else { print "FooterSize . "\">\n"; print "BodyFrame . "\" src=\"" .$this->Url . "\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"auto\" frameborder=\"" . $frameborder . "\" " . $resize . ">\n"; print "FooterFrame . "\" src=\"" . $this->FooterUrl . "\" marginwidth=\"0\" marginheight=\"0\" scrolling=\"auto\" frameborder=\"" . $frameborder . "\" " . $resize . ">\n"; } print "\n"; print "<body bgcolor=\"#FFFFFF\" LINK=\"Blue\" ALINK=\"Teal\" VLINK=\"Blue\" text=\"Navy\">\n"; print "You are now leaving our site! Please visit us again at: <a href='" . $this->ReferringUrl . "'>" . $this->ReferringUrl . "</a>\n"; print "<p><a href=\"" .$this->Url . "\">Click Here to Continue...</a>\n"; print "\n"; print "\n"; print "\n"; if ($this->EnableLogging()) { $this->WriteToLogFile(); } return 1; } # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub OutputFooterFrame { # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # output the HTML headers my $this = shift; # the footer frame is always called by the script, so HTTP_REFERER is # probably not correct and was overridden since we first checked the referrer # check the referrer one more time before outputting the footer: $this->{_IsAuthorized} = $this->_SetAuthorized(); $this->{_IsBanned} = $this->_SetBanned(); # Print error and exit if the domain is banned $this->CrashAndBurn($this->ReferringUrl . " has been banned from using this script.") if ($this->{_IsBanned}); if ($this->{_AllowOnlyAuthorizedDomains} && !$this->{_IsAuthorized}) { # Disallow Unauthorized Domain $this->CrashAndBurn($this->ReferringUrl . " is not authorized to use this script.") } # decode the urls if variables were passed thru $this->Link($this->_UnPassThru($this->Link)); $this->Text($this->_UnPassThru($this->Text)); $this->AdText($this->_UnPassThru($this->AdText)); $this->Url($this->_UnPassThru($this->Url)); $this->AdUrl($this->_UnPassThru($this->AdUrl)); # change AdText manually instead of through the function/wrapper or else the # function will try to do a security check. This is probably not too slick! $this->{'AdText'} = $this->_UnPassThru($this->AdText); print "FrameIt->OutputFooterFrame called (output below)\n\n" if ($this->{_DebugMode}); print "Content-type: text/html\n\n"; print "\n"; print "\n"; print "" . $this->Title . "\n"; print "\n"; print "FooterBackground() . "\" bgcolor=\"" . $this->FooterBgcolor() . "\" link=\"" . $this->FooterTextColor() . "\" vlink=\"" . $this->FooterTextColor() . "\">\n"; print "
\n"; print "<" . $this->FooterTextStyle . ">" if ($this->FooterTextStyle); print "FooterTextColor . "\" face=\"" . $this->FooterFontFace . "\" size=\"" . $this->FooterFontSize . "\">\n"; print "LinkTarget . "\" href=\"" . $this->Link . "\">" . $this->Text . "\n"; print "| LinkTarget . "\" href=\"" . $this->Url . "\">Remove Frame\n" if ($this->ShowRemoveFrame); print "| BodyFrame . "\" href=\"" . $this->AdUrl . "\">" . $this->AdText . "\n" if ($this->ShowAd && $this->AdUrl && !($this->{_IsAuthorized} && $this->HideAdAuthorized)); print "\n"; print "FooterTextStyle . ">" if ($this->FooterTextStyle); print "
\n"; print "\n"; print "\n"; return 1; } # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub OutputDefault { # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # output the HTML headers my $this = shift; print "FrameIt->OutputDefault called (output below)\n\n" if ($this->{_DebugMode}); print "Content-type: text/html\n\n"; print "\n"; print "\n"; print "" . $this->Title . "\n"; print "\n"; print "\n"; $this->OutputBanner(); if ($this->{_ShowUrlWizard}) { print "URL WIZARD\n"; print "

\n"; print "

ScriptUrl . "\" method=\"get\">\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; if ($this->{_ShowDebugOption}) { print "\n"; } print "\n"; print "
TextForLinkText for the FrameIt link
UrlUrl . "\" size=\"30\">URL for the body frame (url: required)
TextText or Image for footer link (string/url)
TitleTitle for browser window (string)
\n"; print "\n"; print "\n"; print "
 
The settings below this line are optional
FooterSizeSize of footer in pixels (integer)
FooterLocation\n"; print " \n"; print "Location of footer frame (1,2,3)
FooterFontFaceText font of footer (string)
FooterFontSize\n"; print " \n"; print "Font size of footer text (integer)
ShowRemoveFrameDispay Remove Frame link (1 or -1)
LinkOverride URL of footer link (url)
BodyFrameFrameset name of the body frame (string)
FooterFrameFrameset name of the footer frame (string)
LinkTargetLink target for footer link (string)
FooterBgcolorColor of footer frame (color)
FooterTextColorColor of footer text (color)
FooterTextStyle\n"; print " \n"; print "Font style
FooterBackgroundFooter background image (image url)
AllowResizeAllow frames to be resized (1 or -1)
FrameBorderFrame Border (1 or -1)
\n"; print "\n"; print "\n"; print "
 
The settings below this line may be available only to authorized domains
FooterUrlOverride the footer frame (url)
ShowAdDispay link to Ad/sponsor (1 or -1)
AdTextText or Image of the ad link in footer (string/url)
AdUrlAd/sponsor page (url)
ConfigFileAlternate config file (file path)
DebugDebug Mode (1 or 0)
\n"; print "\n"; print "\n"; print "
\n"; print "
\n"; } $this->OutputFooter(); print "\n"; print "\n"; return 1; } # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub OutputCode { # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # output the HTML headers my $this = shift; print "FrameIt->OutputCode called (output below)\n\n" if ($this->{_DebugMode}); print "Content-type: text/html\n\n"; print "\n"; print "\n"; print "ShowCode\n"; print "\n"; print "\n"; $this->OutputBanner(); $host = "http://" . $ENV{'HTTP_HOST'}; my $code = $this->ScriptUrl . "?"; $code .= "Url=" . $this->_PassThru($this->Url); $code .= "&Text=" . $this->_PassThru($this->Text) unless ($this->Text eq $configFileVariables{'Text'}); $code .= "&Title=" . $this->_PassThru($this->Title) unless ($this->Title eq $configFileVariables{'Title'}); $code .= "&FooterSize=" . $this->FooterSize unless ($this->FooterSize eq $configFileVariables{'FooterSize'}); $code .= "&FooterLocation=" . $this->FooterLocation unless ($this->FooterLocation eq $configFileVariables{'FooterLocation'}); $code .= "&FooterFontFace=" . $this->FooterFontFace unless ($this->FooterFontFace eq $configFileVariables{'FooterFontFace'}); $code .= "&FooterFontSize=" . $this->FooterFontSize unless ($this->FooterFontSize eq $configFileVariables{'FooterFontSize'}); $code .= "&ShowRemoveFrame=" . $this->ShowRemoveFrame unless ($this->ShowRemoveFrame eq $configFileVariables{'ShowRemoveFrame'}); $code .= "&ShowAd=" . $this->ShowAd unless ($this->ShowAd eq $configFileVariables{'ShowAd'}); $code .= "&AdText=" . $this->_PassThru($this->AdText) unless ($this->AdText eq $configFileVariables{'AdText'}); $code .= "&AdUrl=" . $this->_PassThru($this->AdUrl) unless ($this->AdUrl eq $configFileVariables{'AdUrl'}); $code .= "&Link=" . $this->_PassThru($this->Link) unless (($this->Link eq $configFileVariables{'Link'}) || $this->Link eq $this->ReferringUrl); $code .= "&FooterUrl=" . $this->_PassThru($this->FooterUrl) unless (($this->FooterUrl eq $configFileVariables{'FooterUrl'}) || $this->FooterUrl =~ /\?footer=1/); $code .= "&BodyFrame=" . $this->BodyFrame unless ($this->BodyFrame eq $configFileVariables{'BodyFrame'}); $code .= "&FooterFrame=" . $this->FooterFrame unless ($this->FooterFrame eq $configFileVariables{'FooterFrame'}); $code .= "&LinkTarget=" . $this->LinkTarget unless ($this->LinkTarget eq $configFileVariables{'LinkTarget'}); $code .= "&FooterBgcolor=" . $this->FooterBgcolor unless ($this->FooterBgcolor eq $configFileVariables{'FooterBgcolor'}); $code .= "&FooterTextColor=" . $this->FooterTextColor unless ($this->FooterTextColor eq $configFileVariables{'FooterTextColor'}); $code .= "&FooterBackground=" . $this->FooterBackground unless ($this->FooterBackground eq $configFileVariables{'FooterBackground'}); $code .= "&AllowResize=" . $this->AllowResize unless ($this->AllowResize eq $configFileVariables{'AllowResize'}); $code .= "&FrameBorder=" . $this->FrameBorder unless ($this->FrameBorder eq $configFileVariables{'FrameBorder'}); $code .= "&ConfigFile=" . $this->ConfigFile unless ($this->ConfigFile eq $configFileVariables{'ConfigFile'}); print "
\n"; print "\n"; print "
\n"; print "Here's Your Link:\n"; print "
\n"; print "

\n"; print "" . $this->TextForLink . "\n"; print "

\n"; print "Please note that the return link won't work correctly from this page!
\n"; print "You have to copy the HTML code and paste it onto your website.
\n"; print "

\n"; print "Here's The HTML Code For Your Link:\n"; print "
\n"; print "\n"; print "
\n"; print "Working on your site off-line?\n"; print "
\n"; print "

\n"; print "If you are working on your site off-line, please keep in mind that the return link\n"; print "may not work correctly. To properly test your FrameIt link, you need to first upload\n"; print "your page to the server. The reason for this is that the web server provides FrameIt\n"; print "with the referring URL. If you are working on your page from a local copy on your \n"; print "hard drive, then there is no web server involved and FrameIt will use the AdUrl.\n"; print "

\n"; $this->OutputFooter(); print "
\n"; print "\n"; print "\n"; return 1; } # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub OutputBanner { # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ my $this = shift; print "
\n"; print "FrameIt " . $this->Version . "
\n"; print "Advanced Link Redirector\n"; print "
\n"; print "

\n"; return 1; } # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub OutputFooter { # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ my $this = shift; print "


\n"; my $adText = $this->AdText; $adText =~ s/\+/ /g; print "\n"; print "AdUrl . "\">" . $adText . "\n" if ($adText && $this->AdUrl); print $adText . "\n" if ($adText && !$this->AdUrl); print "\n"; print "

\n"; return 1; } # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub WriteToLogFile { # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ my $this = shift; my $name = "WriteToLogFile"; my $logFile = $this->LogFilePath; my $date = $this->_GetDate . " -0500"; # wite to the logfile. my $logEntry = $this->{'_LogHost'} . " - - [" . $date . "] \"GET " . $this->Url . " HTTP/1.0\" 200 1000 \"" . $this->{'_LogReferrer'} . "\" \"" . $this->{'_LogAgent'} . "\"\n"; if (-w "$logFile") { # Open the file for appending and insert the record at the end. open(LOGFILE, ">>$logFile"); print LOGFILE "$logEntry"; close LOGFILE; print "FrameIt->" . $name . " wrote to: " . $logFile . " {\n" if ($this->{_DebugMode}); print " " . $logEntry if ($this->{_DebugMode}); print "}\n" if ($this->{_DebugMode}); } else { print "FrameIt->" . $name . " unable to write to: " . $logFile . " {\n" if ($this->{_DebugMode}); print " " . $logEntry if ($this->{_DebugMode}); print "}\n" if ($this->{_DebugMode}); $this->CrashAndBurn("Unable to write to: " . $logFile) if ($this->{_ShowWarnings}); return 0; } return 1; } # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub CrashAndBurn { # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ # output the HTML headers my $this = shift; my $message = shift; print "FrameIt->CrashAndBurn called (output below)\n\n" if ($this->{_DebugMode}); print "Content-type: text/html\n\n"; print "\n"; print "\n"; print "" . $this->Title . "\n"; print "\n"; print "\n"; $this->OutputBanner(); print "ERROR: " . $message . "\n"; print "

\n"; print "Please use the back button on your browser to return to the previous\n"; print "screen. If you continue to have problems, please contact the webmaster.\n"; $this->OutputFooter(); print "\n"; print "\n"; print "\nFrameIt exited with a warning.\n" if ($this->{_DebugMode}); exit; } sub _SetAuthorized { my $this = shift; my $referrerOk = 0; my $tempReferrer; # First convert AuthorizedDomains string variable into an array my @authorized = split(/,/,$this->{_AuthorizedDomains}); my $referringUrl = $this->ReferringUrl; if ($referringUrl) { foreach $tempReferrer (@authorized) { $referrerOk = 1 if ($referringUrl =~ m|https?://([^/]*)$tempReferrer|i); } } else { # no referrer. The script was called manually, or via a bookmark $referrerOk = 2; } print "FrameIt->_SetAuthorized returned: " . $referrerOk . "\n" if ($this->{_DebugMode}); return ($referrerOk); } sub _SetBanned { my $this = shift; my $referrerOk = 0; my $tempReferrer; # First convert AuthorizedDomains string variable into an array my @authorized = split(/,/,$this->{_BannedDomains}); my $referringUrl = $this->ReferringUrl; if ($referringUrl) { foreach $tempReferrer (@authorized) { $referrerOk = 1 if ($referringUrl =~ m|https?://([^/]*)$tempReferrer|i); } } else { # no referrer. The script was called manually, or via a bookmark $referrerOk = 0; } print "FrameIt->_SetBanned returned: " . $referrerOk . "\n" if ($this->{_DebugMode}); return ($referrerOk); } sub _GetDate { my $this = shift; # Define arrays for the days of the week and months of the year. my @days = ('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'); my @months = ('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec'); # Get the current date and time from the server my ($sec,$min,$hour,$mday,$mon,$year,$wday) = (localtime(time))[0,1,2,3,4,5,6]; # format the time and weekday my $time = sprintf("%02d:%02d:%02d",$hour,$min,$sec); $mday = sprintf("%02d",$mday); # Add 1900 to the year to get the full 4 digit year. $year += 1900; # Format the date into HTTP logfile format my $date = "$mday/$months[$mon]/$year:$time"; return($date); } # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub _StringToArray { # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ my $class = shift; my $string = shift; my $delimiter = shift || ","; my @array; ## split the items into an array @array = split(/$delimiter/,$string); return @array; } # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub _PassThru { # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ my $class = shift; my $string = shift; $string =~ s/\=/\?\?/g; $string =~ s/\&/\?\?\?/g; $string =~ s/ /\+/g; return $string; } # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub _UnPassThru { # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ my $class = shift; my $string = shift; $string =~ s/\?\?\?/\&/g; $string =~ s/\?\?/\=/g; $string =~ s/\+/ /g; return $string; } # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ sub _UrlEncode { # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ my $class = shift; my $value = shift; $value =~ s/([^a-zA-Z0-9])/'%'.unpack("H*",$1)/eg; $value =~ tr/ /+/; return $value; }