#!/usr/bin/perl use CGI ':standard'; use Net::FTP; BEGIN { #flush STDOUT immediately $| = 1; print header(-type=>'text/html'); } open(PAGE,">time.txt"); $now=localtime; print PAGE $now; close PAGE; $session=rand($numbers=1000); open STDERR, ">tmp/$session.txt"; if ($ENV{REQUEST_METHOD} ne "POST") { exit; } $username = param('user'); $password = param('pass'); $target = param('target'); $changed = param('changed'); $change = param('change'); $directory = param('dir'); $file = param('file'); $type = param('type'); if(param('redo')) { open(FILE,">tmp/$file"); $changed =~ s/\r\n/\n/g; $changed =~ s/\r/\n/g; $changed =~ s/tex-tarea/textarea/ig; print FILE $changed; close FILE; } &do_work; sub do_work { use Net::FTP; $ftp = Net::FTP->new("$target",Debug=>1); $ftp->login("$username","$password"); $ftp->cwd("$directory"); $ftp->type("A"); $ftp->put("tmp/$file","$file"); $ftp->size("$file"); $ftp->quit; } sub finish_up { unlink("tmp/$change.txt"); unlink("tmp/$file"); unlink("tmp/$session.txt"); } close STDERR; &show_data; sub show_data { print qq!
!; print "";
open(DATA," ";
print "Your transaction took $passed seconds to complete";
}
print " ";
print qq!