#!/usr/local/bin/perl # HOW comes from Html-On-the-Web # written by Aytekin Tank, 1999 # make sure to read "how.txt" # you dont need to modify anything in this file # but if you change the names of these files # make sure change here too. $how_temp = "how_temp.htm"; $list_file = "temp_list.txt"; # tell browser that this will be an html file print "Content-type: text/html\n\n"; # get the input from the form: &readparse; # put the header in its place &start; # get the password and the list of the files # from our small config file: open (TEMP, "<$list_file"); $password = ; while(($thisrow = )) { if($thisrow ne "\n") { push(@files, join("", split("\n", $thisrow))); }} close TEMP; # check for password, if wrong bye bye! if ($password eq "") { print "\n\n
something is wrong with $list_file"; &end; } chomp($password); # The form above to select the file to be modified: if ($password ne $input{'password'} ) { print "


"; print "
password: "; print ""; &pull_down; print "
"; &end; } # modified file is being replaced with the older one: if ($input{'file'} ne "") { $html = $input{'html'}; $html =~ s/\<\*textarea\>/<\/textarea>/; open (FILE, ">$input{'file'}"); print FILE $html; close FILE; } # the forms and html stuff print "

\n"; print "
\n"; print "\n"; &pull_down; print "
\n"; print "
\n"; print "\n"; print "\n"; print "File: $input{'selected'}\n"; print " \n"; &pull_down; print " \n"; print " \n"; print "


\n"; &end; # This places the file into the textarea. # inside the textarea give me a little headache # because of its premature ending. # But I solved it like this: sub get_file { open (FILE, "<$input{'selected'}"); while(($thisrow = )) { $thisrow =~ s/\<\/textarea\>/\<\*textarea\>/; print $thisrow; } close FILE; } # the pull down menu: sub pull_down { print "

\n"; print " \n"; } # the header sub start { open (HOWTEMP, "<$how_temp"); while(($thisrow = )) { push(@howtemplate, $thisrow); } close HOWTEMP; @howtemplate = split("%%HOW HERE%%", join("\n", @howtemplate)); print $howtemplate[0]; } # the end of the html text sub end { print $howtemplate[1]; exit; } ############################### # FORM PARSE ############################### sub readparse { read(STDIN,$user_string,$ENV{'CONTENT_LENGTH'}); if (length($ENV{'QUERY_STRING'})>0) {$user_string=$ENV{'QUERY_STRING'}}; $user_string =~ s/\+/ /g; @name_value_pairs = split(/&/,$user_string); foreach $name_value_pair (@name_value_pairs) { ($keyword,$value) = split(/=/,$name_value_pair); $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C",hex($1))/ge; $input{$keyword} = $value; } }