#!/usr/bin/perl
#
# print header stuff
#
print "Content-type: text/html", "\n\n";
print "<html>\n";
print "<body background=\"nevada.gif\">\n";
#
#define stuff to grab data entered on form
#
require CGI;
use CGI;
$cgi = new CGI;
#
# get the data they entered in the text bos
#
$formtext=$cgi->param('text');
$formfile=$cgi->param('file');
$zfilename=$cgi->param('zfilename');
$zpassword=$cgi->param('zpassword');
print "<tt>";
print "&lt;html&gt;<br>";
print "&lt;tt&gt;<br>";
#$zfilename="";
#print "password=$zpassword<br>";
if ($zpassword ne "*****************************") {
    $zfilename="";
    #print "BAD PASSWORD<br>";
}
if ($zfilename =~  /^ ******************.pl *$/i  ||
    $zfilename =~  /^ *\./i  ||
    $zfilename eq ".."  ||
    $zfilename eq "****************.pl"  ||
    $zfilename eq "." ) {
 $zfilename="index.html";
}
#
# if they gave a file name convert the files contents to HTML
#
if ($zfilename !~ /^ *$/) {
   open(ALL,"$zfilename");
   while(<ALL>) {
      s/&/&amp;amp;/g;
      s/</&amp;lt;/g;
      s/>/&amp;gt;/g;
      s/ /&amp;nbsp;/g;
      s/\n/&lt;br&gt;<br>\n/;
      print "$_";
   }
   close(ALL);
}
else {
 #
 # if they didnt give a file name 
 # convert the contents of the box to
 # html
 #
 @outlines=split(/[\r]/, $formtext);
 for ($i=0;$i<=$#outlines;$i++) {
  $_=$outlines[$i];
   s/&/&amp;amp;/g;
   s/</&amp;lt;/g;
   s/>/&amp;gt;/g;
   s/ /&amp;nbsp;/g;
   s/\n/&lt;br&gt;<br>\n/;
   print "$_";
 }
 print "&lt;br&gt;<br>";
}
print "&lt;/tt&gt;<br>";
print "&lt;/html&gt;<br>";
print "</pre>";
print "</tt>";
print "<form action=\"dump_to_html.pl\" method=\"post\">";
print "<input type=\"submit\" name=submit value=\"SUBMIT\">";
print "<input type=\"text\" name=\"zfilename\" value=\"$zfilename\">";
print "<input type=\"password\" name=\"zpassword\" value=\"$zpassword\">";
print "<br>";
print "<textarea name=\"text\" cols=\"100\" rows=\"20\">";
print "$formtext";
print "</textarea>";
print "<hr>";
print "<input type=\"reset\" name=reset value=\"CLEAR MENU\">";
print "<input type=\"hidden\" name=\"formname\" value=\"resume.form\">";
print "</form>";
print "</html>\n";
exit;