CGI/Perl Guide | Learning Center | Forums | Advertise | Login
Site Search: in

  Main Index MAIN
Search Posts SEARCH
Who's Online WHO'S
Log in LOG

Home: Perl Programming Help: Beginner:
File Download



Jul 20, 2001, 2:44 PM

Post #1 of 2 (515 views)
File Download Can't Post

I have the following cgi and I want the result of this query to come back as a downloadable file, any ideas??? I am going nuts on this please help me:


print "Content-type: text/plain\n\n" ;
$r =;
$b =";
$g =";
$dataset = " grav";

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;

$dbase = $form{'database'};

$latlw = $form{'latlow'};
$lathi = $form{'lathigh'};
$longlt = $form{'longleft'};
$longrt = $form{'longright'};

$redirect = " 2> "; # This will redirect into display
$blank = " ";

$outfile = " /dev/null";
$remove = "rm ";
$remove = $remove.$outfile;

$command = $r.$b.$g.$dataset.$blank.$dbase.$blank.$latlw.$blank.$lathi.$blank.$longlt.$blank.$longrt;

$data = `$command`;
print $data;


Jul 20, 2001, 5:17 PM

Post #2 of 2 (510 views)
Re: File Download [In reply to] Can't Post

Let me tell you what your script does:
1. First, it takes any input from the user and puts it blindly in a hash.
2. It creates a bunch of variables that are useless. Why would you do $blank = " ", $remove = "rm /dev/null"!!!.
3. It runs "grav stuff stuff stuff stuff stuff" which gives anyone not one or 2 but 5 chances to crack your account, transfer all your emails, delete all your files, change your password, and prints a smiley.

Now, please, for your own good, don't run scipts (is this matt's?) you download directly from the web without having full understanding of what they do and how they function.



Search for (options) Powered by Gossamer Forum v.1.2.0

Web Applications & Managed Hosting Powered by Gossamer Threads
Visit our Mailing List Archives