#!/usr/local/bin/perl ############################################################################## # This is the script made my Matt Kraft and used at the WICN News Board. The original # # WWWBoard script was made by Matt Wright of Matt's Script Archive ; close(NUMBER); if ($num == 99999) { !$num = "1"; } else { $num++; }}############################# Get Prev & Nextsub get_prev { open(NUMBER,"$basedir/$datafile"); $first_prev = ; close(NUMBER); $second_prev = ($first_prev - 1); $third_prev = ($first_prev - 2); $fourth_prev = ($first_prev - 3); $fifth_prev = ($first_prev - 4); $first_next = ($num + 1); $second_next = ($num + 2); $third_next = ($num + 3); $fourth_next = ($num + 4); $fifth_next = ($num + 5); $sixth_next = ($num + 6); $seventh_next = ($num + 7); $eighth_next = ($num + 8); $ninth_next = ($num + 9); $tenth_next = ($num + 10);} ############################# Get Prev Subsub get_prev_sub { open(FIRST,"$basedir/$subdir/$first_prev\.$txt"); $first_prev_sub = ; close(FIRST); open(SECOND,"$basedir/$subdir/$second_prev\.$txt"); $second_prev_sub = ; close(SECOND); open(THIRD,"$basedir/$subdir/$third_prev\.$txt"); $third_prev_sub = ; close(THIRD); open(FOURTH,"$basedir/$subdir/$fourth_prev\.$txt"); $fourth_prev_sub = ; close(FOURTH); open(FIFTH,"$basedir/$subdir/$fifth_prev\.$txt"); $fifth_prev_sub = ; close(FIFTH);}############################# Get Date Number sub get_date_number { open(DATENUM,"$basedir/$datefile"); $datenum = ; close(DATENUM);}####################### # Parse Form Subroutinesub parse_form { # Get the input read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); # Split the name-value pairs @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); # Un-Webify plus signs and %-encoding $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ s///g; if ($allow_html != 1) { $value =~ s/<([^>]|\n)*>//g; } else { unless ($name eq 'body') { $value =~ s/<([^>]|\n)*>//g; } } $FORM{$name} = $value; $FORM{$username} = $value; $FORM{$password} = $value; }}################ Get Variables sub get_variables { if ($FORM{'followup'}) { $followup = "1"; @followup_num = split(/,/,$FORM{'followup'}); $num_followups = @followups = @followup_num; $last_message = pop(@followups); $origdate = "$FORM{'origdate'}"; $origname = "$FORM{'origname'}"; $origsubject = "$FORM{'origsubject'}"; } else { $followup = "0"; } if ($FORM{'username'}) { $username = "$FORM{'username'}"; $username =~ s/"//g; $username =~ s///g; $username =~ s/\&//g; } else { &error(no_username); } if ($FORM{'password'}) { $password = "$FORM{'password'}"; $password =~ s/"//g; $password =~ s///g; $password =~ s/\&//g; } else { &error(no_password); } if ($FORM{'name'}) { $name = "$FORM{'name'}"; $name =~ s/"//g; $name =~ s///g; $name =~ s/\&//g; } else { &error(no_name); } if ($FORM{'email'} =~ /.*\@.*\..*/) { $email = "$FORM{'email'}"; } if ($FORM{'subject'}) { $subject = "$FORM{'subject'}"; $subject =~ s/\&/\&\;/g; $subject =~ s/"/\"\;/g; } else { &error(no_subject); } if ($FORM{'url'} =~ /.*\:.*\..*/ && $FORM{'url_title'}) { $message_url = "$FORM{'url'}"; $message_url_title = "$FORM{'url_title'}"; } if ($FORM{'img'} =~ /.*tp:\/\/.*\..*/) { $message_img = "$FORM{'img'}"; } if ($FORM{'body'}) { $body = "$FORM{'body'}"; $body =~ s/\cM//g; $body =~ s/\n\n/

/g; $body =~ s/\n/
/g; $body =~ s//>/g; $body =~ s/"/"/g; } else { &error(no_body); } if ($quote_text == 1) { $hidden_body = "$body"; $hidden_body =~ s//>/g; $hidden_body =~ s/"/"/g; } ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = localtime(time); if ($sec < 10) { $sec = "0$sec"; } if ($min < 10) { $min = "0$min"; } if ($hour > 12) { $normalHour = $hour - 12; } else { $normalHour = $hour; } if ($mon < 10) { $mon = "0$mon"; } if ($mday < 10) { $mday = "0$mday"; }$PM = "PM";$AM = "AM"; if ($hour > 12) { $apmmin = "$min $PM";}else { $apmmin = "$min $AM";} $the_time = "$normalHour\:$apmmin"; $month = ($mon + 1); @months = ("January","February","March","April","May","June","July","August","September","October","November","December"); if ($use_time == 1) { $date = "$normalHour\:$apmmin $month/$mday/$year"; } else { $date = "$month/$mday/$year"; } $weekday = ($wday + 1); @weekday = ("Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"); $wdate = "$weekday"; if ($wdate eq "1") {$prevdate = "Saturday"} elsif ($wdate eq "2") {$prevdate = "Sunday"} elsif ($wdate eq "3") {$prevdate = "Monday"} elsif ($wdate eq "4") {$prevdate = "Tuesday"} elsif ($wdate eq "5") {$prevdate = "Wednesday"} elsif ($wdate eq "6") {$prevdate = "Thursday"} elsif ($wdate eq "7") {$prevdate = "Friday"} if ($wdate eq "1") {$weekdate = "Sunday"} elsif ($wdate eq "2") {$weekdate = "Monday"} elsif ($wdate eq "3") {$weekdate = "Tuesday"} elsif ($wdate eq "4") {$weekdate = "Wednesday"} elsif ($wdate eq "5") {$weekdate = "Thursday"} elsif ($wdate eq "6") {$weekdate = "Friday"} elsif ($wdate eq "7") {$weekdate = "Saturday"} chop($date) if ($date =~ /\n$/); $long_date = "$months[$mon] $mday, 19$year at $normalHour\:$apmmin"; $begin_date = "$month/$mday/$year";} ################################### Check Passwordsub check_password { #################### if ($username eq "MattKraft") { if ($password eq "twisted01") { &everything_else;} else { print "Location: http://www.M-D-K.com/wicnnewsboard/wrongpass.html\n\n"; } }######################Copy this and change Username and Password## #################### elsif ($username eq "DemianAllik") { if ($password eq "royal34"){ &everything_else;} else { print "Location: http://www.M-D-K.com/wicnnewsboard/wrongpass.html\n\n"; } }######################End Copying###################### elsif ($username eq "Museluv") { if ($password eq "rlatngml"){ &everything_else;} else { print "Location: http://www.M-D-K.com/wicnnewsboard/wrongpass.html\n\n"; } }####Dave the Rave elsif ($username eq "davetherave") { if ($password eq "iloverassl"){ &everything_else;} else { print "Location: http://www.M-D-K.com/wicnnewsboard/wrongpass.html\n\n"; } }####Darkside elsif ($username eq "darkside") { if ($password eq "tsninfo"){ &everything_else;} else { print "Location: http://www.M-D-K.com/wicnnewsboard/wrongpass.html\n\n"; } }####DDPeck elsif ($username eq "diamonddpeck") { if ($password eq "ddpecksare4ever"){ &everything_else;} else { print "Location: http://www.M-D-K.com/wicnnewsboard/wrongpass.html\n\n"; } }####Sportsworld elsif ($username eq "sportsworld") { if ($password eq "backstage"){ &everything_else;} else { print "Location: http://www.M-D-K.com/wicnnewsboard/wrongpass.html\n\n"; } }####Oscar Garcia elsif ($username eq "newguyis1") { if ($password eq "guyisnew1"){ &everything_else;} else { print "Location: http://www.M-D-K.com/wicnnewsboard/wrongpass.html\n\n"; } }####David Trahan elsif ($username eq "wrestler") { if ($password eq "martelcoach"){ &everything_else;} else { print "Location: http://www.M-D-K.com/wicnnewsboard/wrongpass.html\n\n"; } }####WWFMadness elsif ($username eq "madness") { if ($password eq "imcrazy"){ &everything_else;} else { print "Location: http://www.M-D-K.com/wicnnewsboard/wrongpass.html\n\n"; } }####Steve Slagle elsif ($username eq "iamknown") { if ($password eq "idontknow"){ &everything_else;} else { print "Location: http://www.M-D-K.com/wicnnewsboard/wrongpass.html\n\n"; } }####Ogibeht elsif ($username eq "greatpics") { if ($password eq "pictures"){ &everything_else;} else { print "Location: http://www.M-D-K.com/wicnnewsboard/wrongpass.html\n\n"; } }####The Flying Scotsman elsif ($username eq "Scots") { if ($password eq "GlasgowPWW"){ &everything_else;} else { print "Location: http://www.M-D-K.com/wicnnewsboard/wrongpass.html\n\n"; } }####Kevin Ash elsif ($username eq "nashpac") { if ($password eq "fd34ay"){ &everything_else;} else { print "Location: http://www.M-D-K.com/wicnnewsboard/wrongpass.html\n\n"; } }####Major elsif ($username eq "major") { if ($password eq "hollywood"){ &everything_else;} else { print "Location: http://www.M-D-K.com/wicnnewsboard/wrongpass.html\n\n"; } }####SJJ elsif ($username eq "SJJ") { if ($password eq "981wctk"){ &everything_else;} else { print "Location: http://www.M-D-K.com/wicnnewsboard/wrongpass.html\n\n"; } }####Mike Green elsif ($username eq "mikeg") { if ($password eq "chloe"){ &everything_else;} else { print "Location: http://www.M-D-K.com/wicnnewsboard/wrongpass.html\n\n"; } }####Ryan Slater elsif ($username eq "Ryan") { if ($password eq "wwf10"){ &everything_else;} else { print "Location: http://www.M-D-K.com/wicnnewsboard/wrongpass.html\n\n"; } }####Tom Claffey elsif ($username eq "report99") { if ($password eq "saturn12"){ &everything_else;} else { print "Location: http://www.M-D-K.com/wicnnewsboard/wrongpass.html\n\n"; } }####M. Kidd elsif ($username eq "MKidd") { if ($password eq "NDLancer23"){ &everything_else;} else { print "Location: http://www.M-D-K.com/wicnnewsboard/wrongpass.html\n\n"; } }####Jonathan Michaels elsif ($username eq "RSW") { if ($password eq "tapout"){ &everything_else;} else { print "Location: http://www.M-D-K.com/wicnnewsboard/wrongpass.html\n\n"; } }######################Last Username/Password## else { print "Location: http://www.M-D-K.com/wicnnewsboard/wrongpass.html\n\n"; }}############################################ Every Else Subroutine sub everything_else {# Open the new file and write information to it.&new_file; # Open the new subject file&new_subject; # Open the Main WWWBoard File to add link&themain_page; # Now Add Thread to Individual Pagesif ($num_followups >= 1) { &thread_pages;} # Return the user HTML&return_html;# Increment Number&increment_num; # Increment Date Number&increment_date_num;# Write Subject into Prev Messages &first_prev_page;&second_prev_page;&third_prev_page;&fourth_prev_page; &fifth_prev_page;}###################### New File Subroutinesub new_file { open(NEWFILE,">$basedir/$mesgdir/$num\.$ext") || die $!; print NEWFILE "\n"; print NEWFILE " \n"; print NEWFILE " $subject\n"; print NEWFILE " \n"; print NEWFILE " \n"; print NEWFILE " \n"; print NEWFILE " \n"; print NEWFILE " \n"; print NEWFILE "
\n"; print NEWFILE "

\n"; print NEWFILE " Next 5 Messages
\n"; print NEWFILE " \n"; print NEWFILE " \n"; print NEWFILE " Not Posted Yet\n"; print NEWFILE "

\n"; print NEWFILE " \n"; print NEWFILE " Not Posted Yet\n"; print NEWFILE "

\n"; print NEWFILE " \n"; print NEWFILE " Not Posted Yet\n"; print NEWFILE "

\n"; print NEWFILE " \n"; print NEWFILE " Not Posted Yet\n"; print NEWFILE "

\n"; print NEWFILE " \n"; print NEWFILE " Not Posted Yet\n"; print NEWFILE "

\n"; print NEWFILE " \n"; print NEWFILE "
Previous 5 Messages


\n"; print NEWFILE " \n"; print NEWFILE " $first_prev_sub

\n"; print NEWFILE " $second_prev_sub

\n"; print NEWFILE " $third_prev_sub

\n"; print NEWFILE " $fourth_prev_sub

\n"; print NEWFILE " $fifth_prev_sub


\n"; print NEWFILE " \n"; print NEWFILE " \n"; print NEWFILE "
\n"; print NEWFILE " \n"; print NEWFILE " \n"; print NEWFILE " \n"; print NEWFILE " \n"; print NEWFILE " \n"; print NEWFILE " \n"; print NEWFILE " \n"; print NEWFILE " \n"; print NEWFILE " \n"; print NEWFILE "
\n"; print NEWFILE " WIC\n"; print NEWFILE " WICN News Board\n"; print NEWFILE " M-D-K.com\n"; print NEWFILE " Subscribe to WICN\n"; print NEWFILE " M.A.N.
\n"; print NEWFILE "

$subject

\n"; print NEWFILE " Posted by \n"; if ($email) { print NEWFILE "$name on $long_date

\n"; } else { print NEWFILE "$name on $long_date

\n"; } if ($followup == 1) { print NEWFILE "In Reply to: $origsubject posted by "; if ($origemail) { print NEWFILE "$origname on $origdate:

\n"; } else { print NEWFILE "$origname on $origdate:

\n"; } } print NEWFILE "

\n"; print NEWFILE " \n"; if ($message_img) { print NEWFILE "

\n"; } print NEWFILE "
$body

\n"; if ($message_url) { print NEWFILE "

\n"; } print NEWFILE "
\n"; print NEWFILE "
\n"; print NEWFILE " \n"; print NEWFILE " \n"; print NEWFILE " \n"; print NEWFILE " \n"; print NEWFILE "
\n"; print NEWFILE "Subscribe to the Wrestling Information Center Newsletter. The Official Newsletter of WICN! Don't wait any longer, subscribe now!\n"; print NEWFILE "
\n"; print NEWFILE "
\n"; print NEWFILE " Enter your e-mail address:
\n"; print NEWFILE " \n"; print NEWFILE " \n"; print NEWFILE "
\n"; print NEWFILE " \n"; print NEWFILE "
\n"; print NEWFILE "
\n"; print NEWFILE "
\n"; print NEWFILE " \n"; print NEWFILE "\n"; close(NEWFILE);}###################### New Subject File Subroutine sub new_subject { open(NEWFILE,">$basedir/$subdir/$num\.$txt") || die $!; print NEWFILE "$subject\n"; close(NEWFILE);}############################### # The Main Pagesub themain_page { if ($weekday eq $datenum) {&main_page;} else {&dmain_page;}}############################### # Main WWWBoard Page Subroutinesub main_page { open(MAIN,"$basedir/$mesgfile") || die $!; @main =

; close(MAIN); open(MAIN,">$basedir/$mesgfile") || die $!; if ($followup == 0) { foreach $main_line (@main) { if ($main_line =~ //) { print MAIN "\n"; print MAIN "\n"; print MAIN " \n"; print MAIN " $subject\n"; print MAIN " \n"; print MAIN " $name\n"; print MAIN " \n"; print MAIN " $date\n"; print MAIN "\n"; print MAIN "\n"; } else { print MAIN "$main_line"; } } } else { foreach $main_line (@main) { $work = 0; if ($main_line =~ /
    /) { print MAIN "
      \n"; print MAIN "
    • $subject - $name $date\n"; print MAIN "
        \n"; print MAIN "
      \n"; } elsif ($main_line =~ /\((.*)\)/) { $response_num = $1; $num_responses = $2; $num_responses++; foreach $followup_num (@followup_num) { if ($followup_num == $response_num) { print MAIN "($num_responses)\n"; $work = 1; } } if ($work != 1) { print MAIN "$main_line"; } } else { print MAIN "$main_line"; } } } close(MAIN);}################################### # D Main Pagesub dmain_page { open(MAIN,"$basedir/$mesgfile") || die $!; @main =
      ; close(MAIN); open(MAIN,">$basedir/$mesgfile") || die $!; if ($followup == 0) { foreach $main_line (@main) { if ($main_line =~ //) { print MAIN "\n"; print MAIN "
      The News for $weekdate\n"; print MAIN "\n"; print MAIN "\n"; print MAIN "\n"; print MAIN " \n"; print MAIN " \n"; print MAIN " \n"; print MAIN "\n"; print MAIN "\n"; print MAIN "
      \n"; print MAIN " $subject\n"; print MAIN " $name\n"; print MAIN " $date

      \n"; print MAIN "\n"; print MAIN "\n"; } else { print MAIN "$main_line"; } } } else { foreach $main_line (@main) { $work = 0; if ($main_line =~ /
        /) { print MAIN "
          \n"; print MAIN "
        • $subject - $name $date\n"; print MAIN "
            \n"; print MAIN "
          \n"; } elsif ($main_line =~ /\((.*)\)/) { $response_num = $1; $num_responses = $2; $num_responses++; foreach $followup_num (@followup_num) { if ($followup_num == $response_num) { print MAIN "($num_responses)\n"; $work = 1; } } if ($work != 1) { print MAIN "$main_line"; } } else { print MAIN "$main_line"; } } } close(MAIN);} ############################################ # Add Followup Threading to Individual Pagessub thread_pages { foreach $followup_num (@followup_num) { open(FOLLOWUP,"$basedir/$mesgdir/$followup_num\.$ext"); @followup_lines = ; close(FOLLOWUP); open(FOLLOWUP,">$basedir/$mesgdir/$followup_num\.$ext"); foreach $followup_line (@followup_lines) { $work = 0; if ($followup_line =~ /
            /) { print FOLLOWUP "
              \n"; print FOLLOWUP "
            • $subject $name $date\n"; print FOLLOWUP "(0)\n"; print FOLLOWUP "
                \n"; print FOLLOWUP "
              \n"; } elsif ($followup_line =~ /\((.*)\)/) { $response_num = $1; $num_responses = $2; $num_responses++; foreach $followup_num (@followup_num) { if ($followup_num == $response_num) { print FOLLOWUP "($num_responses)\n"; $work = 1; } } if ($work != 1) { print FOLLOWUP "$followup_line"; } } else { print FOLLOWUP "$followup_line"; } } close(FOLLOWUP); }}###################### Return HTMLsub return_html { print "Content-type: text/html\n\n"; print "Message Added: $subject\n"; print "

              Message Added: $subject

              \n"; print "The following information was added to the message board:


              \n"; print "Name: $name
              \n"; print "E-Mail: $email
              \n"; print "Subject: $subject
              \n"; print "Body of Message:

              \n"; print "$body

              \n"; if ($message_url) { print "Link: $message_url_title
              \n"; } if ($message_img) { print "Image:
              \n"; } print "Added on Date: $date

              \n"; print "


              \n"; print "
              [ Go to Your Message ] [ $title ]
              \n"; print "\n";}######################## Increment Number sub increment_num { open(NUM,">$basedir/$datafile") || die $!; print NUM "$num"; close(NUM);}####################### # Increment Date Numbersub increment_date_num { open(DATENUM,">$basedir/$datefile") || die $!; print DATENUM "$weekday"; close(DATENUM);}######################## Add Subject into Previous Messages sub first_prev_page { open(FIRST,"$basedir/$mesgdir/$first_prev\.$ext") || die $!; @first = ; close(FIRST); open(FIRST,">$basedir/$mesgdir/$first_prev\.$ext") || die $!; if ($followup == 0) { foreach $first_line (@first) { if ($first_line =~ /Not Posted Yet/) { print FIRST "\n"; print FIRST "$subject\n"; print FIRST "\n"; } else { print FIRST "$first_line"; } } } close(FIRST);}### sub second_prev_page { open(SECOND,"$basedir/$mesgdir/$second_prev\.$ext") || die $!; @second = ; close(SECOND); open(SECOND,">$basedir/$mesgdir/$second_prev\.$ext") || die $!; if ($followup == 0) { foreach $second_line (@second) { if ($second_line =~ /Not Posted Yet/) { print SECOND "\n"; print SECOND "$subject\n"; print SECOND "\n"; } else { print SECOND "$second_line"; } } } close(SECOND);} ###sub third_prev_page { open(THIRD,"$basedir/$mesgdir/$third_prev\.$ext") || die $!; @third = ; close(THIRD); open(THIRD,">$basedir/$mesgdir/$third_prev\.$ext") || die $!; if ($followup == 0) { foreach $third_line (@third) { if ($third_line =~ /Not Posted Yet/) { print THIRD "\n"; print THIRD "$subject\n"; print THIRD "\n"; } else { print THIRD "$third_line"; } } } close(THIRD);}### sub fourth_prev_page { open(FOURTH,"$basedir/$mesgdir/$fourth_prev\.$ext") || die $!; @fourth = ; close(FOURTH); open(FOURTH,">$basedir/$mesgdir/$fourth_prev\.$ext") || die $!; if ($followup == 0) { foreach $fourth_line (@fourth) { if ($fourth_line =~ /Not Posted Yet/) { print FOURTH "\n"; print FOURTH "$subject\n"; print FOURTH "\n"; } else { print FOURTH "$fourth_line"; } } } close(FOURTH);}### sub fifth_prev_page { open(FIFTH,"$basedir/$mesgdir/$fifth_prev\.$ext") || die $!; @fifth = ; close(FIFTH); open(FIFTH,">$basedir/$mesgdir/$fifth_prev\.$ext") || die $!; if ($followup == 0) { foreach $fifth_line (@fifth) { if ($fifth_line =~ /Not Posted Yet/) { print FIFTH "\n"; print FIFTH "$subject\n"; print FIFTH "\n"; } else { print FIFTH "$fifth_line"; } } } close(FIFTH);} ###############################sub error { $error = $_[0]; print "Content-type: text/html\n\n"; if ($error eq 'no_username') { print "$title ERROR: No Username\n"; print "

              ERROR: No Username

              \n"; print "You forgot to fill in the 'Username' field in your posting. Correct it below and re-submit. The necessary fields are: Username, Password, Name, Subject and Message.


              \n"; &rest_of_form; } if ($error eq 'no_password') { print "$title ERROR: No Password\n"; print "

              ERROR: No Password

              \n"; print "You forgot to fill in the 'Name' field in your posting. Correct it below and re-submit. The necessary fields are: Username, Password, Name, Subject and Message.


              \n"; &rest_of_form; } if ($error eq 'no_name') { print "$title ERROR: No Name\n"; print "

              ERROR: No Name

              \n"; print "You forgot to fill in the 'Password' field in your posting. Correct it below and re-submit. The necessary fields are: Username, Password, Name, Subject and Message.


              \n"; &rest_of_form; } elsif ($error eq 'no_subject') { print "$title ERROR: No Subject\n"; print "

              ERROR: No Subject

              \n"; print "You forgot to fill in the 'Subject' field in your posting. Correct it below and re-submit. The necessary fields are: Username, Password, Name, Subkect and Message.


              \n"; &rest_of_form; } elsif ($error eq 'no_body') { print "$title ERROR: No Message\n"; print "

              ERROR: No Message

              \n"; print "You forgot to fill in the 'Message' fieldin your posting. Correct it below and re-submit. The necessary fields are: Username, Password, Name, Subject and Message.


              \n"; &rest_of_form; } else { print "ERROR! Undefined.\n"; } exit; }sub rest_of_form { print "\n"; if ($followup == 1) { print "\n"; print "\n"; print "\n"; print "\n"; print "\n"; } print "Username:
              \n"; print "Password:
              \n"; print "Name:
              \n"; print "E-Mail:

              \n"; if ($subject_line == 1) { print "\n"; print "Subject: $FORM{'subject'}

              \n"; } else { print "Subject:

              \n"; } print "Message:
              \n"; print "

              \n"; print "Optional Link URL:
              \n"; print "Link Title:
              \n"; print "Optional Image URL:

              \n"; print " \n"; print "\n"; print "


              \n"; if ($show_faq == 1) { print "
              [ Follow Ups ] [ Post Followup ] [ $title ] [ FAQ ]
              \n"; } else { print "
              [ Follow Ups ] [ Post Followup ] [ $title ]
              \n"; } print "\n";} 1