Passing a form into a cig script

Status
Not open for further replies.

smatt454

New Member
Messages
2
Reaction score
0
Points
0
Hey, I'm trying to make a script to dowload programs i have made. I use a form on my index which is passed into a cgi script.

Here is the sources

index.php
Code:
<html>
  <head>
    <title>
      The Best page ever
    </title>
   </head>
  <body>
    <form action="http://smatt454.x10hosting.com/cgi-bin/download.cgi" method=post>
      <select  name=download>
        <option value=TICGRAPHICS.zip name=file>Tic Tac Toe</option>
        <option value=hangman.zip name=file>Hangman</option>
      </select>
      <br>
      <br>
      <input type=submit value="Download">
    </form> 

  </body>
</html>
download.cgi
Code:
#!/usr/bin/perl
#
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;
}
exit;
(the script is not done, it was but i deleted most of it. I assumed the passing code was the issue, so I only left the passing code in the script.)

I have set the permissions, and have already tested a hello world cgi script.

When i click the submit button, i get redirected and get this error

Internal Server Error

The server encountered an internal error or misconfiguration and was unable to complete your request.
Please contact the server administrator, webmaster@smatt454.x10hosting.com and inform them of the time the error occurred, and anything you might have done that may have caused the error.
More information about this error may be available in the server error log.
Additionally, a 404 Not Found error was encountered while trying to use an ErrorDocument to handle the request.
 

Corey

I Break Things
Staff member
Messages
34,551
Reaction score
204
Points
63
If you check the error log located in cPanel it should give you some more details of the exact error.

-Corey
 
Status
Not open for further replies.
Top