#!/usr/local/bin/perl # # # MasterPFP Version 1.7 # by William Bontrager, # a programmer at willmaster.com. # Version 1.0 completed: February 7, 2000 # Version 1.6 completed: May 12, 2002 # Programmer's Website: http://www.willmaster.com/ # Programmer's Email: programmer@willmaster.com # # Tech Support: http://willmaster.com/master/techsupport/ # # Copyright 2000 by William Bontrager. All rights reserved. # # # Before installing and/or using Master PFP # you must agree to the complete license agreement # linked from http://willmaster.com/master # ############################################################ # # HTML page instructions: # # # Before you install this program, you must agree to the License Agreement. # The License Agreement is linked from the index page at http://willmaster.com/master # # # (1) # The program will display everything up to the first tag. It # will replace your tag with
# Then it will display whatever is between any # # and # # tag sets. The tags don't actually need to be within HTML comments, but the # comment tags make the "...PRINT_FRIENDLY..." tags invisible to users. You # may have as many of those tag sets as you wish, allowing you to be selectively # about what the user will print. Last, the program will finish the page with #
# # (2) # Any images that you will display on the printer friendly page must use # the complete http:// URL rather than a relative URL. Examples -- # this: # not this: # # (3) # The link to MasterPFP must be followed with ?doc= and # either # # i. the complete http://... URL to the page is to display a printer # friendly version of, or # # ii. the directory location of the file of the page to display a printer # friendly version of, relative to your document root. # # Examples: # URL -- # ?doc=http://www.domain.com/stuff/thispage.html # Web page in stuff directory (like above URL) -- # ?doc=stuff/thispage.html # Web page in document root -- # ?doc=thispage.html # # Note: If you specify the directory location instead of the URL, then # if it's an SSI page, it will not contain the content that would # otherwise be included. # # (4) # Optionally, you can direct the program to display a URL at the top # and/or bottom of the printer friendly page. You do this by appending # additional data to the link. The addition data can be # &top=http://www.domain.com/stuff/thispage.html # and/or # &bottom=http://www.domain.com/stuff/thispage.html # The URL in the additional data is to the regular page. # # The following examples show the several different valid link formats. # Just replace the URL, program name/location, and web page name with # what is appropriate for you: # # Click # for printer friendly page # # Click # for printer friendly page # # Click # for printer friendly page # # Click # for printer friendly page # # Click # for printer friendly page # # NOTE: If you use SSI or want consistent code for pasting into numerous pages, you # can use "self" (without the quotes) instead of the page URL. This works for # the doc=, top=, and bottom= URLs. # # Master PFP will then determine the URL of the page the request came form and use it # in place of "self". # # The drawback to this is that some browsers, especially the more recent versions, allow # users to manipulate security and/or privacy and/or anti-tracking settings that, in certain # instances will prevent the browser from sending the current URL to the script. The script # would then give an error message. # # # # # Script installation instructions: # # (1) Ensure the first line of this file points to Perl 5+ # # (2) The my $imagefix = '__________'; line, below, tells the program what to do, # if anything, with the images on the printer friendly version of your page. # Any of the following values can be between the apostrophes (single quotes): # my $imagefix = ''; # my $imagefix = '-'; # my $imagefix = '[IMAGE]'; # my $imagefix = '[Image]'; # my $imagefix = '[Image Location]'; # my $imagefix = 'anything else'; # # The first example (nothing between the apostrophes) tells the program # to do nothing with the images on the printer friendly version of your page. # # The second example (a hyphen or minus sign between the apostrophes) tells # the program to remove the images on the printer friendly version of your page. # # The third through sixth examples (anything other than the first two examples # between the apostrophes) each tells the program to replace the images on # the printer friendly version of your page with whatever is between the # apostrophes. In other words, if it is not either the first or second example # then the program will replace the images on your page with whatever you put # between the apostrophes. And you can include HTML code (demonstrated in the # fourth example). # # The live my $imagefix = '__________'; line is the next line below. my $imagefix = ''; # (3) Upload the program to your server as ASCII/plain text. (A reminder: All # edits must be done with an ASCII/plain text word processor.) # # (4) CHMOD the program to 755. # # That's it. You're ready to test it! # # Tech Support: http://willmaster.com/master/techsupport/ ### ### ### DO NOT CHANGE ANTHING BELOW THIS POINT ### ### ### use LWP::Simple; use strict; my %In = (); my @doc = split(/&/,$ENV{QUERY_STRING}); for (@doc) { my ($n,$v) = split(/=/,$_); $n =~ tr/+/ /; $v =~ tr/+/ /; $n =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg; $v =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/eg; $v =~ s/\