#!/usr/bin/perl ############################################################################## # By BumbleBeeWare.com 2006 # unzip a tar.gz file # unziptar.cgi ############################################################################## print "Content-Type: text/html\n\n"; # Parse incomming data &form_parse; # print the form to get paths if($ENV{"REQUEST_METHOD"} ne "POST") {&print_form;} # make sure the file exists if (-e $FORM{'file_to_unzip'}){} else { print "$FORM{'file_to_unzip'} is not a valid file."; exit;} open (TAR, "/bin/tar -zxf $FORM{'file_to_unzip'} |"); print "$FORM{'file_to_unzip'} has been unzipped"; exit; sub form_parse { read (STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $FORM{$name} = $value; }} sub print_form { print "

This program will allow you to unzip files.

Path to File to Unzip:

"; exit; }