#!/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; if ($ENV{REQUEST_METHOD} ne "POST") { exit; } $copy = param('copy'); $mode = param('mode'); $newdir = param('newdir'); $username = param('user'); $password = param('pass'); $target = param('target'); $newfile = param('newfile'); $file = param('file'); $dir = param('dir'); $type = param('type'); if(param('edite')) { &change_file; } if(param('create')) { &make_file; } if(param('cpy')) { &get_new_file; } &do_work; sub do_work { $session=rand($numbers=1000); open STDERR, ">tmp/$session.txt"; use Net::FTP; $ftp = Net::FTP->new("$target",Debug=>1); $ftp->login("$username","$password"); $ftp->cwd("$dir"); if(param('rename')) { $ftp->rename("$file","$newfile"); } if(param('make_new')) { $ftp->put("tmp/$copy","$copy"); } if(param('del')) { $ftp->delete("$file"); } if(param('new_dir')) { $ftp->mkdir("$newdir",[0755]); } if(param('remove')) { $ftp->rmdir("$file"); } if(param('new_mode')) { $ftp->site(CHMOD,$mode,"$file"); } $ftp->quit; } close STDERR; &show_data; sub show_data { print qq!!; print "

R e m o t e M a N a g e r

"; open(DATA,") { foreach($_=~/Net.*FTP=.*\)(.*)/ig) { $temp=$1; ($temp=~s/([A-Z]+[A-Z]+[A-Z].*)/$1<\/FONT>/g); ($temp=~s/(user\s.*)/$1<\/strong>/g); ($temp=~s/213(.*)/$1 BYTES<\/FONT>/g); print qq!

  • $temp!; } } } open(PAGE,">>time.txt"); $time=localtime; print PAGE $time; close PAGE; open(PAGE,") { $_=~/.*(\d\d)\s2000.*(\d\d)\s2000.*$/ig; $temp=$1; $tempa=$2; if ($tempa < $temp) { $tempa=($tempa+"60"); } $passed=($tempa-$temp); print "

    "; print "Your transaction took $passed seconds to complete"; } print "


    "; print qq!To return to your directory listing just click onto RETURN and continue managing your files and directories.


    !; sub get_new_file { use LWP::Simple; getstore("ftp://$username:$password\@$target/$dir/$file", "tmp/$copy"); print qq!
    To copy $file to $copy click onto COPY
    and the new file will be stored on your server.

    «
    !; exit; } sub change_file { use LWP::Simple; $change=rand($num=1000); getstore("ftp://$username:$password\@$target/$dir/$file", "tmp/$change.txt"); print qq!
    !; open(FILE,"); $lines=~s/textarea/tex-tarea/ig; print qq!
    $username You are currently editing
    $file

    !; exit; } sub make_file { $change=rand($num=1000); print qq!
    !; open(FILE," $username You are currently creating a new file..

    Type in the name of the new file here.
    !; exit; } unlink("tmp/$session.txt"); if(param('make_new')) { unlink("tmp/$copy"); } exit;