Results 1 to 2 of 2

Thread: [RESOLVED] [Perl] A once working code, help?

  1. #1

    Thread Starter
    Member
    Join Date
    Mar 2006
    Posts
    51

    Resolved [RESOLVED] [Perl] A once working code, help?

    To make a long story short, I had a working news update code, didnt realize it worked, and broke it. Because that is how smart I am. I thought I was looking at the perl news page, not the old html one that didnt update unless you coded it. So here's the code that I unfixed:
    (Not VBCODE, just used the tags for ease)
    VB Code:
    1. #!C:\Perl\bin\perl
    2.  
    3. print "Content-type:text/html\n\n";
    4. $pass = 0;
    5. if( $ENV{'REQUEST_METHOD'} eq 'POST')
    6. {read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'})};
    7. @pairs = split(/&/, $buffer);
    8. ($Second, $Minute, $Hour, $Day, $Month, $Year, $WeekDay, $DayOfYear, $IsDST) = localtime(time) ;
    9. use Switch;
    10. switch ($Month) {
    11. case 0                { $Month = "January" }
    12. case 1                { $Month = "February" }
    13. case 2                { $Month = "March" }
    14. case 3                { $Month = "April" }
    15. case 4                { $Month = "May" }
    16. case 5                { $Month = "June" }
    17. case 6                { $Month = "July" }
    18. case 7                { $Month = "August" }
    19. case 8                { $Month = "September" }
    20. case 9                { $Month = "October" }
    21. case 10                { $Month = "November" }
    22. case 11                { $Month = "December" }
    23. else                   { print "Unknown" }
    24. }
    25. if($Day < 10)
    26. {$Day = "0" . $Day ;}
    27. $Year+=1900;
    28. if($Hour > 12)
    29. {$Hour-=12;}
    30. if($Hour < 10){
    31. $Hour = sprintf("%02d",$Hour);}
    32. if($Second < 10){
    33. $Second = sprintf("%02d",$Second);}
    34. if($Minute < 10){
    35. $Minute = sprintf("%02d",$Minute);}
    36. print "<html><head>\n";
    37.  
    38. print "<div name=\"Ad\" style=\"display:none\">\n";
    39. print "<textarea><body></textarea> \n";
    40. print "</div>\n";
    41. print "<META HTTP-EQUIV=Refresh CONTENT=\"10; URL=\"Newnews.pl\">\n";
    42. ($key, $password) = split(/=/, $pairs[1]);
    43. if ($password eq "reggae")
    44. {
    45.   open(News,">>cshcanews.txt");
    46.   $news = split(/&/, <News>);
    47.       ($key, $value) = split(/=/, $line);
    48.       $post = $value;
    49.   print News "Harvey&$post&$Month $Day, $Year $Hour:$Minute:$Second\n";
    50.   close(News);
    51.   $pass = 1;
    52.     print "<HEAD>\n";
    53.     print "<SCRIPT LANGUAGE=\"JavaScript\">\n";
    54.     print "<!-- Hide from older browsers\n";
    55.     print "alert('Your change has been made');\n";
    56.     print "// end hiding -->\n";
    57.     print "</SCRIPT>\n";
    58.     print "</HEAD>\n";
    59. }
    60. else {
    61.     print "<HEAD>\n";
    62.     print "<SCRIPT LANGUAGE=\"JavaScript\">\n";
    63.     print "<!-- Hide from older browsers\n";
    64.     print "alert('Incorrect Password'}');\n";
    65.     print "// end hiding -->\n";
    66.     print "</SCRIPT>\n";
    67.     print "</HEAD>\n";
    68. } print "</head><body background=\"http://fire.prohosting.com/jabal/CSHCA/background.GIF\">\n";
    69. print "<CENTER><TABLE height=\"100\%\"><TR><TD valign=\"middle\"><TABLE valign=\"center\" \"\#000000\" cellpadding=\"0\" cellspacing=\"1\" border=\"0\"><TR><TD bgcolor=\"\#AAAAFF\"><CENTER><BR><BR>Please wait while we forward you back to the news update screen.<BR><BR></TD></TR><TR><TD bgcolor=\"\#0000FF\"><A HREF=\"Newnews.pl\"><CENTER>Or click here if you do not wish to wait.</A></TD></TR></TABLE></TD></TR></TABLE></CENTER>\n";
    70. print "<!-- </body> --></body></html>\n";
    71. print "</HTML>\n";
    No thats not the real password, I plan on changing it. Also just so you know, the code is supposed to take the post and password. the password will identify that Harvey made the post, so we dont need a user name. It will then take the post and add it to the text file, and the time of day it was done. The news perl file that displays the infop still works.

    Thanks for the help,
    Jabal
    Take time to rate helpful posts
    And then go help me.

  2. #2

    Thread Starter
    Member
    Join Date
    Mar 2006
    Posts
    51

    Re: [Perl] A once working code, help?

    Well, I figured it out, it was an error in the #! line
    I forgot to change it for linux -.-
    So, I guess this topic can be deleted, it was a stupid mistake.
    Take time to rate helpful posts
    And then go help me.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width