#! /usr/bin/perl -w use CGI qw(:standard); ########################################### #change $dir to the directory in which you #will store your temporary files #you will have to create this directory #and change it's permissions to 777 #you must manually move files from this tmp #directory to the html directory ########################################### #$dir = "/home/httpd/stuff"; #$dir = "/var/www/stuff"; $dir = "."; ########################################### # don't change anything else # ########################################### $html_page = param("page"); $file = $html_page; $color = param("color"); $input = param("input"); $title = param("title"); $font = param("font_color"); $reprint = param("reprint"); $template = "
"; $template_end = ("
"); $script="/home/httpd/html/pop.html"; if (($input && $html_page) && (($html_page ne 'yourpage.html') && ($html_page =~ /.html$/)) ){ =pod if($input =~ /[;<>\*\|`&\$!#\(\)\[\]\{\}'"]/ || $html_page =~ /[;<>\*\|`&\$!#\(\)\[\]\{\}'"]/){ &bad_input(); exit; } =cut my $taint_value = is_tainted($input); if ($taint_value){ &error(); exit; } print header(), start_html("html composer"); print ("
"); $i =0; @hold=split(/\n/, $input); foreach(@hold){ $input[$i] = $_; $i++; } chdir "$dir" or die "cannot change dirs: $!"; open (OUT, ">$file") || die "cannot open $file to write: $!"; system("chmod", "0777", "$file"); print OUT $template; print OUT ("

"); print OUT $title; print OUT ("

"); print OUT ("


"); foreach(@input){ if(/.gif/ || /.jpg/ || /.jpeg/){ s/\s+//; print OUT (""); print OUT "
"; }elsif(/print line/) { s/\s+//; print OUT ("


"); }elsif($_ =~ /.com/ ||$_ =~ /.org/ || $_ =~ /.net/){ print OUT ('$_
"; }else { print OUT $_."
"; } } print OUT $template_end; close OUT; open IN, "$file" or die "can't open $file to read: $!"; while(){ print; } close IN; print ("
"); print end_html(); } elsif(($input && !$html_page) || (($input) && (!($html_page =~ /.html$/))) || (($input) && ($html_page eq 'yourpage.html'))){ print header(), start_html("html composer"); print (""); print ("

Please enter the name of
your temporary html page.
For example:
yourpage.html
(Substitute a unique name for \"yourpage\")
To continue click on your browser's back button

"); print end_html(); } elsif($reprint){ print header(), start_html(), start_form(); print ""; print '<H1>[Web Page Composer]</H1>'; print ''; # print "

"; #print ''; #print ""; #print '"; #print '"; print ""; print ""; print "
'; # print ''; print '"; print '"; print '
'; print "
'; print ''; print "
Instructions
"; print "1) Enter the html page name i.e.
something_unique.html
"; print "2) Just type your web page content
in the big white textarea.
"; print "3) To include an image, it must be in your
server's icons or image directory
"; print "Just type the name of the image , including
its extension on it's ownline,
i.e. myimage.gif
"; print "4) To type a horizontal line, type
'print line' on it's own line...
no quotes, no spaces.
"; print "5) To include a hyperlink, type the
name of the link minus the 'http://'
that will be added for you.
"; print "6) Use all other options as wanted
"; print "






"; #print ("Want to get your old page source?
"); #print ("Enter the name of your html file below
"); #print ("Also enter this filename in the
html page name field
"); #print ''; #print p(submit("get source")); print "
'; print "
"; print ' '; print "

"; print '

'; # print "

"; print '

'; print ''; print'
'; #$input = ; print "
"; print "
"; print '
'; print "'; print ''; print "
"; print 'background color: '; print 'page title: '; #print ("font color: ", textfield("font_color", "$font")); print ''; print 'font color: '; print 'html page name: '; print ''; print '
"; #print "

"; print ""; # print "

"; print ""; #print "
'; #print ''; #print "
"; print "
"; print ""; print ""; print end_html(), end_form(); } else { print header(), start_html("html_composer"),start_form(); =pod print ""; print ''; print '
'; print '

Howto

'; =cut print "<H2>[WebPage Composer]</H2>"; #bgCOlor used to be 5c4033 print ''; # print "

"; #print ''; #print ""; #print '"; print ""; print "
'; # print ''; print '"; print '"; #print ''; #bgcolor used to be 336699 print '
'; print "
'; print ''; print ''; print ' instructions'; #print ''; #print "
Instructions
"; #print "1) Enter the html page name i.e.
something_unique.html
"; #print "2) Just type your web page content
in the big white textarea.
"; #print "3) To include an image, it must be in your
server's icons or image directory
"; #print "Just type the name of the image , including
its extension on it's ownline,
i.e. myimage.gif
"; #print "4) To type a horizontal line, type
'print line' on it's own line...
no quotes, no spaces.
"; #print "5) To include a hyperlink, type the
name of the link minus the 'http://'
#that will be added for you.
"; #print "6) Use all other options as wanted
"; #print "






"; #print ("Want to get your old page source?
"); #print ("Enter the name of your html file below
"); #print ("Also enter this filename in the
html page name field
"); #print ''; #print p(submit("get source")); print "
'; print "
"; print ' '; print "

"; print '

'; # print "

"; print '

'; print '
'; print "
"; print "
"; print ''; print '
'; #print '
Control Panel
'; print "'; print ''; #print ''; #print "
#
"; print ''; print 'background color: '; print ''; print 'page title: '; print ''; print 'font color: '; print ''; print 'html page name: '; print ''; #print ''; #print '
"; print "

"; #print ""; # print "

"; print ""; print "
"; print "
"; print end_form(), end_html(); } sub bad_input(){ print header(), start_html(); print "Please do not use any characters which might program our system"; print end_html(); } sub is_tainted{ my $check = shift; return !eval {$check++, kill 0; 1;}; } sub error{ print header(), start_html(); print "Sorry, You have entered input which is considered to be tainted and may disrupt our system.
Please try again.
"; print end_html(); }