errors

  • dreamer7
  • Student
  • Student
  • dreamer7
  • Posts: 95
  • Loc: UK

Post 3+ Months Ago

well for some reason just recently my cgi perl files have started to not wen work wen they worked before i keep gettin an error come up saying there is a internal error or misconfiguration and then tells me to look at error logs and the error log comes up with this:
[Mon Mar 17 03:04:23 2003] [error] [client 62.64.166.247] File does not exist: /home/dj_ajax1/public_html/500.shtml
[Mon Mar 17 03:04:23 2003] [error] [client 62.64.166.247] malformed header from script. Bad header= : /home/dj_ajax1/public_html/cgi-bin/test1.cgi

can anyone explain what ive done or need to do to change this
D7
  • Anonymous
  • Bot
  • No Avatar
  • Posts: ?
  • Loc: Ozzuland
  • Status: Online

Post 3+ Months Ago

  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9072
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

Yes, the first error you mention:

Code: [ Select ]
[Mon Mar 17 03:04:23 2003] [error] [client 62.64.166.247] File does not exist: /home/dj_ajax1/public_html/500.shtml


is simply saying its trying to find the custom error page you have, but it cannot find it. So if you made a custom page called 500.shtml and put whatever you want in it saying your site has had a problem or whatever, then that line wouldnt show up in your logs anymore, and would give your visitor maybe a more friendly error message.

The real error is caused by this line:

Code: [ Select ]
[Mon Mar 17 03:04:23 2003] [error] [client 62.64.166.247] malformed header from script. Bad header= : /home/dj_ajax1/public_html/cgi-bin/test1.cgi


and all that is saying is you have a bad hearder, usually that is caused by not printing "Content-type: text/html\n\n" before you start printing out to the browser, however there could be other conditions that cause it as well. Can you remember anything you have changed since you knew it was working last?
  • dreamer7
  • Student
  • Student
  • dreamer7
  • Posts: 95
  • Loc: UK

Post 3+ Months Ago

wel here is the code:
Code: [ Select ]
#!/usr/bin/perl

use CGI::Carp qw(fatalsToBrowser);

require "cgi-lib.pl";

&ReadParse (*input);
$n = $input {'name'};
$a = $input {'age'};
$c = $input {'dropdown'};
$s = $input {'swear'};

if ($input {'swear'} =~ /[a-zA-Z]/)
{
@swear1=(@swear,"$input {'swear'}");
}

@swear=("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M","N", "O","P", "Q");

srand (time | $$);
$numswear = scalar (@swear);
$random = int (rand ($numswear));
$ranswear = $swear[$random];
$news = pop(@swear);

print "@swear1 \n";
if($input{'dropdown'} eq "yellow")
{
$html2 = "<body bgcolor=\"yellow\">\n";
}

if($input{'dropdown'}eq "blue")
{
$html2 = "<body bgcolor=\"blue\">\n";
}

if($input{'dropdown'}eq "red")
{
$html2 = "<body bgcolor=\"red\">\n";
}

$header = "MIME-Version: 1.0\n";
$header .= "Content-type: text/html\n\n";

$html = "<html>\n";
$html .= "<head>\n";
$html .= "<title>\n";
$html .= "Form Data\n";
$html .= "</title>\n";
$html .= "</head>\n";
$html .= "$html2";
$html .= "<p>You said your name was <b>$n</b> and your age was <b>$a</b>.</p>\n";
$html .= "\n";
$html .= "<p>The color you chose was\n";
$html .= "<b>$c</b>\n";
$html .= "<p>The randomiser says:<b>$ranswear</b>\n";
$html .= "<p>The newest letter is:<b>$news</b>\n";

$html .= "</body>\n";
$html .= "</html>\n";

print "$header$html2$html";
exit;
  1. #!/usr/bin/perl
  2. use CGI::Carp qw(fatalsToBrowser);
  3. require "cgi-lib.pl";
  4. &ReadParse (*input);
  5. $n = $input {'name'};
  6. $a = $input {'age'};
  7. $c = $input {'dropdown'};
  8. $s = $input {'swear'};
  9. if ($input {'swear'} =~ /[a-zA-Z]/)
  10. {
  11. @swear1=(@swear,"$input {'swear'}");
  12. }
  13. @swear=("A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L", "M","N", "O","P", "Q");
  14. srand (time | $$);
  15. $numswear = scalar (@swear);
  16. $random = int (rand ($numswear));
  17. $ranswear = $swear[$random];
  18. $news = pop(@swear);
  19. print "@swear1 \n";
  20. if($input{'dropdown'} eq "yellow")
  21. {
  22. $html2 = "<body bgcolor=\"yellow\">\n";
  23. }
  24. if($input{'dropdown'}eq "blue")
  25. {
  26. $html2 = "<body bgcolor=\"blue\">\n";
  27. }
  28. if($input{'dropdown'}eq "red")
  29. {
  30. $html2 = "<body bgcolor=\"red\">\n";
  31. }
  32. $header = "MIME-Version: 1.0\n";
  33. $header .= "Content-type: text/html\n\n";
  34. $html = "<html>\n";
  35. $html .= "<head>\n";
  36. $html .= "<title>\n";
  37. $html .= "Form Data\n";
  38. $html .= "</title>\n";
  39. $html .= "</head>\n";
  40. $html .= "$html2";
  41. $html .= "<p>You said your name was <b>$n</b> and your age was <b>$a</b>.</p>\n";
  42. $html .= "\n";
  43. $html .= "<p>The color you chose was\n";
  44. $html .= "<b>$c</b>\n";
  45. $html .= "<p>The randomiser says:<b>$ranswear</b>\n";
  46. $html .= "<p>The newest letter is:<b>$news</b>\n";
  47. $html .= "</body>\n";
  48. $html .= "</html>\n";
  49. print "$header$html2$html";
  50. exit;


the only thing is none of my cgi files work and there is like 7 of them with all the same error
D7
  • dreamer7
  • Student
  • Student
  • dreamer7
  • Posts: 95
  • Loc: UK

Post 3+ Months Ago

it doesnt do much i was just playin about with it but it was supposed to output the name and age in the html file and also a random letter in the array but i didnt get around to tryin to make it so that the input can add to the array any help with that help wud b much appreciated and also the dropdown of 3 colours changing the background colour to that on the html
D7
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9072
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

So all the cgi files that do not work are all completely different programs? to me it sounds more like a server issue if that is the case and maybe you should contact your host. I don't see anything offhand in that code that would be wrong.
  • Bigwebmaster
  • Site Admin
  • Site Admin
  • User avatar
  • Posts: 9072
  • Loc: Seattle, WA & Phoenix, AZ

Post 3+ Months Ago

Maybe for these lines

Code: [ Select ]
if($input{'dropdown'}eq "blue")
{
$html2 = "<body bgcolor=\"blue\">\n";
}

if($input{'dropdown'}eq "red")
{
$html2 = "<body bgcolor=\"red\">\n";
}
  1. if($input{'dropdown'}eq "blue")
  2. {
  3. $html2 = "<body bgcolor=\"blue\">\n";
  4. }
  5. if($input{'dropdown'}eq "red")
  6. {
  7. $html2 = "<body bgcolor=\"red\">\n";
  8. }


make sure you got a space before the eq on both of those lines so it looks like

Code: [ Select ]
if($input{'dropdown'} eq "blue")
{
$html2 = "<body bgcolor=\"blue\">\n";
}

if($input{'dropdown'} eq "red")
{
$html2 = "<body bgcolor=\"red\">\n";
}
  1. if($input{'dropdown'} eq "blue")
  2. {
  3. $html2 = "<body bgcolor=\"blue\">\n";
  4. }
  5. if($input{'dropdown'} eq "red")
  6. {
  7. $html2 = "<body bgcolor=\"red\">\n";
  8. }


I am not sure if that might cause a problem.

Post Information

  • Total Posts in this topic: 6 posts
  • Users browsing this forum: No registered users and 81 guests
  • You cannot post new topics in this forum
  • You cannot reply to topics in this forum
  • You cannot edit your posts in this forum
  • You cannot delete your posts in this forum
  • You cannot post attachments in this forum
 
cron
 

© 1998-2014. Ozzu® is a registered trademark of Unmelted, LLC.