)) / 4);
close(LOCFILE);
}
unless ($querydate) {
$rootnum = $num;
$rootdate = $gmt_epoch;
$HEADER{"Root MessageID"} = $rootnum;
$HEADER{"Root Date"} = $rootdate;
}
}
###############
# Get Variables
sub get_variables {
# Follow-up variables
if ($FORM{'rootnum'}) {
$rootnum = $FORM{'rootnum'};
$rootdate = $FORM{'rootdate'};
$HEADER{"Root MessageID"} = $rootnum;
$HEADER{"Root Date"} = $rootdate;
if (($rootdate + $expire_time * 3600) < $gmt_epoch) { &error(too_old); }
}
# Get name
if ($FORM{'name'}) {
$name = "$FORM{'name'}";
$name =~ s/"//g;
$name =~ s//g;
$name =~ s/>//g;
$name =~ s/\&//g;
}
else {
&error(no_name);
}
# Load message (if clicked)
if ($FORM{'submit'} eq "Load") {
&load_message;
&error(loaded);
}
# Quote message (if clicked)
if ($FORM{'submit'} eq "Quote") {
"e_message;
&error(quoted);
}
# Get e-mail
if ($FORM{'email'} =~ /\@.*\./) {
$email = $FORM{'email'};
}
# Check if the author of this message wants e-mail responses
if ($FORM{'mailto'}) {
$mailto = $FORM{'mailto'};
}
# Correct/add SpellCheck words
foreach $formkey (keys %FORM) {
if ($formkey =~ /spellcheck-(.*)/) {
$word = $1;
unless ($FORM{$formkey} eq "+") {
$FORM{'body'} =~ s/>$word>$FORM{$formkey}$word([^\w<>=\"])/>$FORM{$formkey}$1/g;
$FORM{'body'} =~ s/([^\w<>=\"])$word$1$FORM{$formkey}=\"])/$FORM{$formkey}$1/g;
$FORM{'body'} =~ s/([^\w<>=\"])$word$/$1$FORM{$formkey}/g;
$FORM{'body'} =~ s/([^\w<>=\"])$word([^\w<>=\"])/$1$FORM{$formkey}$2/g;
$FORM{'body'} =~ s/([^\w<>=\"])$word([^\w<>=\"])/$1$FORM{$formkey}$2/g;
}
else {
$soundex = uc(substr($word,0,1));
$soundexnum = lc(substr($word,1));
$soundexnum =~ s/[aehiouwy]//g;
$soundex = $soundex.uc(substr($soundexnum,0,1));
$soundexnum =~ tr/bfpv/1/;
$soundexnum =~ tr/cgjkqsxz/2/;
$soundexnum =~ tr/dt/3/;
$soundexnum =~ tr/l/4/;
$soundexnum =~ tr/mn/5/;
$soundexnum =~ tr/r/6/;
$soundex = $soundex.substr($soundexnum,1,2).uc(substr($word,-1,1));
open(DICTIONARY,">>$basedir/$slangfile") || &tech_error("Can't append to slang dictionary file, $basedir/$slangfile!");
print DICTIONARY "$word=$soundex\n";
close(DICTIONARY);
}
}
}
# Filter words
if ($use_filter) {
foreach $word (keys %filter) {
$word_lower = $word;
$word_lower =~ tr/A-Z/a-z/;
$word_lower =~ tr/À-Ö/à-ö/;
$word_lower =~ tr/Ù-Ý/ù-ý/;
$word_upper = $word;
$word_upper =~ tr/a-z/A-Z/;
$word_upper =~ tr/à-ö/À-Ö/;
$word_upper =~ tr/ù-ý/Ù-Ý/;
$word_capital = substr($word_upper, 0, 1).substr($word_lower, 1);
$replace_lower = $filter{$word};
$replace_lower =~ tr/A-Z/a-z/;
$replace_lower =~ tr/À-Ö/à-ö/;
$replace_lower =~ tr/Ù-Ý/ù-ý/;
$replace_upper = $filter{$word};
$replace_upper =~ tr/a-z/A-Z/;
$replace_upper =~ tr/à-ö/À-Ö/;
$replace_upper =~ tr/ù-ý/Ù-Ý/;
$replace_capital = substr($replace_upper, 0, 1).substr($replace_lower, 1);
$FORM{'subject'} =~ s/\Q$word_lower/$replace_lower/g;
$FORM{'subject'} =~ s/\Q$word_upper/$replace_upper/g;
$FORM{'subject'} =~ s/\Q$word_capital/$replace_capital/g;
$FORM{'subject'} =~ s/\Q$word/$filter{$word}/gi;
$FORM{'body'} =~ s/\Q$word_lower/$replace_lower/g;
$FORM{'body'} =~ s/\Q$word_upper/$replace_upper/g;
$FORM{'body'} =~ s/\Q$word_capital/$replace_capital/g;
$FORM{'body'} =~ s/\Q$word/$filter{$word}/gi;
$FORM{'spoilbody'} =~ s/\Q$word_lower/$replace_lower/g;
$FORM{'spoilbody'} =~ s/\Q$word_upper/$replace_upper/g;
$FORM{'spoilbody'} =~ s/\Q$word_capital/$replace_capital/g;
$FORM{'spoilbody'} =~ s/\Q$word/$filter{$word}/gi;
}
}
# Subjectline
$FORM{'subject'} = substr($FORM{'subject'}, 0, $subjectline_length);
$FORM{'subject'} =~ s/\s*$//g;
if ($FORM{'subject'}) {
$subject = "$FORM{'subject'}";
$subject =~ s/&/&/g;
$subject =~ s/"/"/g;
$subject =~ s/</g;
$subject =~ s/>/>/g;
$subject =~ s/ / /g;
$subject =~ s/ / /g;
}
else {
&error(no_subject);
}
if ($subject =~ /(.*)[\(\*\-\/\\]nt[\\\/\-\*\)]$/i) {
$subject = $1;
$subject =~ s/\s*$//g;
$FORM{'msgtags'} = "N";
}
if ($FORM{'submit'} eq "*nt*") { $FORM{'msgtags'} = "N"; }
# Optional link
if ($FORM{'url'} =~ /\:.+\..+\// && $FORM{'url_title'}) {
$message_url = "$FORM{'url'}";
$message_url =~ s//g;
$message_url =~ s/>//g;
$message_url_title = "$FORM{'url_title'}";
$message_url_title =~ s//g;
$message_url_title =~ s/>//g;
}
# Optional image
if ($FORM{'img'} =~ /\:.+\..+\// && $use_html >= 2) {
$message_img = "$FORM{'img'}";
$message_img =~ s//g;
$message_img =~ s/>//g;
}
# Background
if ($FORM{'bgtype'}) {
$bgtype = "$FORM{'bgtype'}";
}
# Message tags
if ($FORM{'msgtags'}) {
$msgtag = "$FORM{'msgtags'}";
}
# Game/Section information
if ($FORM{'section'}) {
$section = "$FORM{'section'}";
$section =~ s//g;
$section =~ s/>//g;
}
if ($msgtag eq "N") {
if ($message_url && $message_img) { $section = "Link/Image Inside" }
elsif ($message_url) { $section = "Link Inside" }
elsif ($message_img) { $section = "Image Inside" }
else { undef $section; }
}
# Message/spoiler body
$FORM{'body'} =~ s/^[\s\n]*$//g;
$FORM{'spoilbody'} =~ s/^[\s\n]*$//g;
unless ($use_html) {
$FORM{'body'} =~ s/<(.*?)>/$1/g;
$FORM{'spoilbody'} =~ s/<(.*?)>/$1/g;
}
elsif ($use_html == 1) {
$FORM{'body'} =~ s/<[\s]*IMG(.*?)>//gi;
$FORM{'body'} =~ s/<[\s]*EMBED(.*?)>//gi;
$FORM{'body'} =~ s/<[\s]*[\/]?TABLE(.*?)>//gi;
$FORM{'body'} =~ s/<[\s]*[\/]?T[DHR](.*?)>//gi;
$FORM{'spoilbody'} =~ s/<[\s]*IMG(.*?)>//gi;
$FORM{'spoilbody'} =~ s/<[\s]*EMBED(.*?)>//gi;
$FORM{'spoilbody'} =~ s/<[\s]*[\/]?TABLE(.*?)>//gi;
$FORM{'spoilbody'} =~ s/<[\s]*[\/]?T[DHR](.*?)>//gi;
}
elsif ($use_html == 2) {
$FORM{'body'} =~ s/<[\s]*[\/]?TABLE(.*?)>//gi;
$FORM{'body'} =~ s/<[\s]*[\/]?T[DHR](.*?)>//gi;
$FORM{'spoilbody'} =~ s/<[\s]*[\/]?TABLE(.*?)>//gi;
$FORM{'spoilbody'} =~ s/<[\s]*[\/]?T[DHR](.*?)>//gi;
}
if ($FORM{'body'}) {
$body = "$FORM{'body'}";
$body =~ s/\cM//g;
if ($FORM{'convert_html'} || !($use_html)) {
$body =~ s/\n\n//g;
$body =~ s/\n/ /g;
$body =~ s/ / /g;
$body =~ s/ / /g;
$body =~ s/(.{80})(.*?) /$1$2\n/g
}
}
elsif ($msgtag ne "N") {
&error(no_body);
}
if ($FORM{'spoilbody'}) {
$spoilbody = "$FORM{'spoilbody'}";
$spoilbody =~ s/\cM//g;
if ($FORM{'convert_html'} || !($use_html)) {
$spoilbody =~ s/\n\n/
/g;
$spoilbody =~ s/\n/ /g;
$spoilbody =~ s/ / /g;
$spoilbody =~ s/ / /g;
$spoilbody =~ s/(.{80})(.*?) /$1$2\n/g
}
}
if ($msgtag eq "N" && $body) {
&error(body_with_notext);
}
# E-Mail response switch
if ($FORM{'email_responses'} && $use_email) {
if ($email) { $email_responses = "1"; }
else { &error(no_email); }
}
# Save message (if clicked)
if ($FORM{'submit'} eq "Save") {
&save_message;
&error(saved);
}
}
#############################
# Check for banned IP numbers
sub check_banlist {
open(BANLIST,"$basedir/$banfile") || &tech_error("Can't read ban file, $basedir/$banfile! Does it exist?");
@banlist = ;
close(BANLIST);
foreach $ban_line (@banlist) {
if ($ban_line =~ /^(.+?)\s.*$/) {
$regexpr = $1;
$regexpr =~ s/^\s*//g;
$regexpr =~ s/\s*$//g;
$regexpr =~ s/\./\\\./g;
$regexpr =~ s/\*/\.\+/g;
$regexpr = "^".$regexpr."\$";
if ($remotehost =~ /$regexpr/) {
&unlock_datefile(&convert_date($gmt_epoch, " 0000", 0).".loc");
&error(banned);
}
elsif ($ENV{'REMOTE_ADDR'} =~ /$regexpr/) {
&unlock_datefile(&convert_date($gmt_epoch, " 0000", 0).".loc");
&error(banned);
}
elsif ($ENV{'HTTP_X_FORWARDED_FOR'} =~ /$regexpr/) {
&unlock_datefile(&convert_date($gmt_epoch, " 0000", 0).".loc");
&error(banned);
}
}
}
}
################
# Spell Checker!
sub spell_check {
if ($dictionaryfile =~ /\.bz2$/) { open(DICTIONARY,"/usr/bin/bzip2 -cd $basedir/$dictionaryfile |") || &tech_error("Can't unbzip and/or read dictionary file $basedir/$dictionaryfile!"); }
elsif ($dictionaryfile =~ /\.gz$/) { open(DICTIONARY,"/bin/gzip -cd $basedir/$dictionaryfile |") || &tech_error("Can't ungzip and/or read dictionary file $basedir/$dictionaryfile!"); }
else { open(DICTIONARY,"$basedir/$dictionaryfile") || &tech_error("Can't read dictionary file $basedir/$dictionaryfile!"); }
@dictionary = split(/\n/,join('',));
close(DICTIONARY);
foreach $wordpair (@dictionary) {
($word,$soundex) = split(/=/,$wordpair);
$dictionary{$word} = $soundex;
$soundex{$soundex} = $soundex{$soundex}.$word." ";
}
open(DICTIONARY,"$basedir/$slangfile");
@dictionary = split(/\n/,join('',));
close(DICTIONARY);
foreach $wordpair (@dictionary) {
($word,$soundex) = split(/=/,$wordpair);
$dictionary{$word} = $soundex;
$soundex{$soundex} = $soundex{$soundex}." ".$word;
}
$wordbody = $FORM{'body'};
$wordbody =~ s/\n/ /g;
$wordbody =~ s/<(.*?)>//g;
$wordbody =~ s/\.\.\./ /g;
$wordbody =~ s/\-/ /g;
$wordbody =~ s/[^\w\s]//g;
$wordbody =~ s/\d//g;
$wordbody =~ s/\_//g;
$wordbody =~ s/[\s]+/ /g;
$wordbody =~ s/^[\s]+//g;
@words = split(/ /,$wordbody);
foreach $word (@words) {
$soundex = uc(substr($word,0,1));
$soundexnum = lc(substr($word,1));
$soundexnum =~ s/[aehiouwy]//g;
$soundex = $soundex.uc(substr($soundexnum,0,1));
$soundexnum =~ tr/bfpv/1/;
$soundexnum =~ tr/cgjkqsxz/2/;
$soundexnum =~ tr/dt/3/;
$soundexnum =~ tr/l/4/;
$soundexnum =~ tr/mn/5/;
$soundexnum =~ tr/r/6/;
$soundex = $soundex.substr($soundexnum,1,2).uc(substr($word,-1,1));
$words{$word} = $soundex;
}
foreach $msgword (keys %words) {
if ($dictionary{lc($msgword)}) {
next;
}
unless ($dictionary{$msgword}) {
$selectline = "$msgword";
$soundex{$words{$msgword}} =~ s/^[\s]+//g;
foreach $dictword (split(/ /,$soundex{$words{$msgword}})) {
if (lc($dictword) eq $msgword) {
$selectline = "$msgword $dictword";
last;
}
elsif ($dictword eq lc($dictword) && $msgword eq uc($msgword)) {
$selectline = $selectline." ".uc($dictword);
}
elsif ($dictword eq lc($dictword) && $msgword eq ucfirst($msgword)) {
$selectline = $selectline." ".ucfirst($dictword);
}
else {
$selectline = $selectline." $dictword";
}
}
$selectline = $selectline." *Add* ";
$body =~ s/>$msgword>$selectline$msgword([^\w<>=\"])/>$selectline$1/g;
$body =~ s/([^\w<>=\"])$msgword$1$selectline=\"])/$selectline$1/g;
$body =~ s/([^\w<>=\"])$msgword$/$1$selectline/g;
$body =~ s/([^\w<>=\"])$msgword([^\w<>=\"])/$1$selectline$2/g;
$body =~ s/([^\w<>=\"])$msgword([^\w<>=\"])/$1$selectline$2/g;
}
}
}
#######################
# View Post Subroutine
sub view_post {
$body = "$mesgfont$body\n\n$footerbody";
if ($use_backgrounds) { $j = $bgcolor[$bgtype]; } else { $j = $bgcolor; }
if ($spoilbody) { $spoilbody = "$mesgfont\"$spoilbody \""; }
print "Content-type: text/html; charset=$charset\n\n";
print "\n";
print "
\n";
print " \n";
print " \n";
print " View Your Message \n";
print "\n";
if ($use_backgrounds) {
print "
\n";
}
elsif ($standardbg) {
print "
\n";
}
else {
print "
\n";
}
print "$header\n";
print "$headerfontView Your Message \n";
print "$forumline
\n";
print "This is your message. If you have an error, make your changes below. Any words you select from the SpellCheck will be changed on the next preview, so you don't need to worry about changing them in the message box.
\n";
print "
\n";
&print_credits;
}
#!/usr/bin/perl
##############################################################################
# RPGBoard Message Header Display version 2.10a #
# Copyleft 1999 Brendan Byrd and Resonator Software #
# Contact me at: sineswiper@resonatorsoft.com #
##############################################################################
$SIG{__DIE__} = \&tech_error;
sub tech_error {
print "Content-type: text/plain; charset=$charset\n\n";
print "ERROR: $_[0]";
exit;
}
for $j ("rpgvariables.h", "rpgglobal.h", "rpgheaders.h") {
unless ($k = do $j) {
&tech_error("Couldn't parse $j: $@") if $@;
&tech_error("Couldn't do $j: $!") unless defined $k;
}
}
if ($COOKIE{'Name'}) { $name = $COOKIE{'Name'}; }
&get_default;
&get_master_default;
if ($FORM{'expire'}) { $expire_time = $FORM{'expire'} }
print "Content-type: text/html; charset=$charset\n\n";
print "$forumline\n";
if ($name) {
print "$rpgheadersfont$name on ".&convert_date($gmt_epoch, $timezone, $datemode."0");
if ($masterpassword eq crypt("password", "8e")) { print " \nChange the master default password! "; }
print " \n";
}
else {
print $rpgheadersfont.&convert_date($gmt_epoch, $timezone, $datemode."0")." \n";
}
&display_headers;
print $rpgheadersfont.int($newerposts)." Fresh + ".int($newposts)." New + ".int($oldposts)." Old = ".int($newerpost+$newposts+$oldposts)." Total headers \n";
print "$forumline\n";
print "\n";
print "\n";
print "Display messages from: \ \n";
for ($j = 0; $j < @labels; $j++) {
print "$labels[$j]\n";
}
print " \n";
print "\ \n";
print " \n";
print " \n";
&print_credits;
exit;
##############################################################################
# RPGBoard Errors version 2.10a #
# Copyleft 1999 Brendan Byrd and Resonator Software #
# Contact me at: sineswiper@resonatorsoft.com #
##############################################################################
sub error {
$error = $_[0];
print "Content-type: text/html; charset=$charset\n\n";
if ($error eq 'no_name') {
print "\n";
print "
\n";
print " \n";
print " \n";
print " Name Needed \n";
print "\n";
print "
\n";
print "$header\n";
print "".$headerfont."No Name \n";
print "$forumline
\n";
print "You forgot to fill in the 'Name' field in your posting. Correct it below and re-submit. The necessary fields are Name and Subject.
\n";
if ($ENV{'SCRIPT_NAME'} eq $rpgboard_uri) {
print "$forumline\n";
print "\n";
&rest_of_form;
}
else {
&print_credits;
}
}
elsif ($error eq 'no_password') {
print "\n";
print "
\n";
print " \n";
print " \n";
print " Password Needed \n";
print "\n";
print "
\n";
print "$header\n";
print "".$headerfont."No Password \n";
print "$forumline
\n";
print "You forgot to fill in the 'Password' field. Hit the back button, correct the problem, and re-submit.
\n";
if ($ENV{'SCRIPT_NAME'} eq $rpgboard_uri) {
print "$forumline\n";
print " \n";
&rest_of_form;
}
else {
&print_credits;
}
}
elsif ($error eq 'bad_password') {
print "\n";
print "
\n";
print " \n";
print " \n";
print " Bad Password \n";
print "\n";
print "
\n";
print "$header\n";
print "".$headerfont."Bad Password \n";
print "$forumline
\n";
print "You entered a password which doesn't match the password in record. Hit the back button, correct the problem, and re-submit.
\n";
if ($ENV{'SCRIPT_NAME'} eq $rpgboard_uri) {
print "$forumline\n";
print " \n";
&rest_of_form;
}
else {
&print_credits;
}
}
elsif ($error eq 'name_used') {
print "\n";
print "
\n";
print " \n";
print " \n";
print " Conflicting Names \n";
print "\n";
print "
\n";
print "$header\n";
print "".$headerfont."Name Already in Use \n";
print "$forumline
\n";
print "You entered a name which already exists in the records. Pick another name.
\n";
&print_credits;
}
elsif ($error eq 'no_pw_match') {
print "\n";
print "
\n";
print " \n";
print " \n";
print " Conflicting Passwords \n";
print "\n";
print "
\n";
print "$header\n";
print "".$headerfont."Passwords Don't Match \n";
print "$forumline
\n";
print "You entered a password which doesn't match the password on the 'Re-enter Password' field. Hit the back button, correct the problem, and re-submit.
\n";
&print_credits;
}
if ($error eq 'no_email') {
print "\n";
print "
\n";
print " \n";
print " \n";
print " E-Mail Address Needed \n";
print "\n";
print "
\n";
print "$header\n";
print "".$headerfont."No E-Mail Address \n";
print "$forumline
\n";
print "You forgot to fill in the 'E-Mail' field in your posting. You'll need it if you expect any e-mail responses to your message. Correct it below and re-submit.
\n";
print "$forumline\n";
print " \n";
&rest_of_form;
}
elsif ($error eq 'no_msg') {
print "\n";
print "
\n";
print " \n";
print " \n";
print " Can't Find Message \n";
print "\n";
print "
\n";
print "$header\n";
print "".$headerfont."Message Does Not Exist \n";
print "$forumline
\n";
print "The message you requested to delete does not exist!
\n";
&print_credits;
}
elsif ($error eq 'too_many') {
print "\n";
print "
\n";
print " \n";
print " \n";
print " Too Many Messages \n";
print "\n";
print "
\n";
print "$header\n";
print "".$headerfont."Message Thread is Too Dense \n";
print "$forumline
\n";
print "The message you requested to delete already has replies to it, therefore it's beyond your power to delete it! Ask an administrator to delete it for you.
\n";
&print_credits;
}
elsif ($error eq 'no_rpgadmin') {
print "\n";
print "
\n";
print " \n";
print " \n";
print " Can't use RPGAdmin \n";
print "\n";
print "
\n";
print "$header\n";
print "".$headerfont."Can't use RPGAdmin \n";
print "$forumline
\n";
print "Only administrators can use RPGAdmin. If you want to delete a message, use the delete function on the messages.
\n";
&print_credits;
}
elsif ($error eq 'no_undelete') {
print "\n";
print "
\n";
print " \n";
print " \n";
print " Can't Undelete \n";
print "\n";
print "
\n";
print "$header\n";
print "".$headerfont."Can't Undelete \n";
print "$forumline
\n";
print "Only administrators can undelete messages. If you need to get a message undeleted, ask one of them.
\n";
&print_credits;
}
elsif ($error eq 'no_body') {
print "\n";
print "
\n";
print " \n";
print " \n";
print " Message Needed \n";
print "\n";
print "
\n";
print "$header\n";
print "".$headerfont."No Message \n";
print "$forumline
\n";
print "You forgot to fill in your message. If this is a subject-only message, please mark the 'No Text' tag.
\n";
print " \n";
&rest_of_form;
}
elsif ($error eq 'no_subject') {
print "\n";
print "
\n";
print " \n";
print " \n";
print " Subject Needed \n";
print "\n";
print "
\n";
print "$header\n";
print "".$headerfont."No Subject \n";
print "$forumline
\n";
print "You forgot to fill in the 'Subject' field in your posting. Correct it below and re-submit. The necessary fields are Name and Subject.
\n";
print " \n";
&rest_of_form;
}
elsif ($error eq 'body_with_notext') {
print "\n";
print "
\n";
print " \n";
print " \n";
print " No Text Message with a Body \n";
print "\n";
print "
\n";
print "$header\n";
print "".$headerfont."Body With \"No Text\" Tag \n";
print "$forumline
\n";
print "You have a message with a \"No Text\" tag. Either delete the text from the message or take off the \"No Text\" tag.
\n";
print " \n";
&rest_of_form;
}
elsif ($error eq 'need_register') {
print "\n";
print "
\n";
print " \n";
print " \n";
print " Name Not Found \n";
print "\n";
print "
\n";
print "$header\n";
print "".$headerfont."Name not Registered \n";
print "$forumline
\n";
print "You need to register your name in the Defaults database before you can post here.
\n";
print " \n";
&rest_of_form;
}
elsif ($error eq 'loaded') {
print "\n";
print "
\n";
print " \n";
print " \n";
print " Message Loaded \n";
print "\n";
print "
\n";
print "$header\n";
print "".$headerfont."Message Loaded \n";
print "$forumline
\n";
print "Your message has been loaded. You may complete your message below.
\n";
print " \n";
&rest_of_form;
}
elsif ($error eq 'quoted') {
print "\n";
print "
\n";
print " \n";
print " \n";
print " Message Quoted \n";
print "\n";
print "
\n";
print "$header\n";
print "".$headerfont."Message Quoted \n";
print "$forumline
\n";
print "The reply has been quoted. You may complete your message below.
\n";
print " \n";
&rest_of_form;
}
elsif ($error eq 'saved') {
print "\n";
print "
\n";
print " \n";
print " \n";
print " Message Saved \n";
print "\n";
print "
\n";
print "$header\n";
print "".$headerfont."Message Saved \n";
print "$forumline
\n";
print "Your message has been saved. If your message gets erased before you get to post it, you can hit the Load button and try again.
\n";
print " \n";
&rest_of_form;
}
elsif ($error eq 'record_deleted') {
print "\n";
print "
\n";
print " \n";
print " \n";
print " Record Deleted \n";
print "\n";
print "
\n";
print "$header\n";
print "".$headerfont."Record Deleted \n";
print "$forumline
\n";
print "The requested record has been deleted.
\n";
&print_credits;
}
elsif ($error eq 'record_not_found') {
print "\n";
print "
\n";
print " \n";
print " \n";
print " Can't Find Record \n";
print "\n";
print "
\n";
print "$header\n";
print "".$headerfont."Record Not Found \n";
print "$forumline
\n";
print "The requested record can't be found. Either the default record was deleted or it never existed in the first place.
\n";
&print_credits;
}
elsif ($error eq 'too_old') {
print "\n";
print "
\n";
print " \n";
print " \n";
print " \n";
print " Message Too Old \n";
print "\n";
print "
\n";
print "$header\n";
print "".$headerfont."Message Expired \n";
print "$forumline
\n";
print "The message you are trying to reply from is too old for replies. Try some of the newer threads :)
\n";
print "Back to $title ";
&print_credits;
}
elsif ($error eq 'msg_deleted') {
print "\n";
print "
\n";
print " \n";
print " \n";
print " \n";
print " Message Deleted \n";
print "\n";
print "
\n";
print "$header\n";
print "".$headerfont."Message Doesn't Exist \n";
print "$forumline
\n";
print "The message you are trying to reply/moderate from has been marked for deletion. You can't reply/moderate to deleted messages.
\n";
print "Back to $title ";
&print_credits;
}
elsif ($error eq 'msg_purged') {
print "\n";
print "
\n";
print " \n";
print " \n";
print " \n";
print " Message Purged \n";
print "\n";
print "
\n";
print "$header\n";
print "".$headerfont."Message Data Doesn't Exist \n";
print "
$forumline
\n";
print "This message has been permanently deleted. There is no way to read it.
\n";
print "Back to $title ";
&print_credits;
}
elsif ($error eq 'dupe_msg') {
print "\n";
print "
\n";
print " \n";
print " \n";
print " \n";
print " Duplicate Message \n";
print "\n";
print "
\n";
print "$header\n";
print "".$headerfont."Message Already Exists \n";
print "$forumline
\n";
print "You have already posted your message. Remember, it only takes one button click to post your message.
\n";
print "Back to $title ";
&print_credits;
}
elsif ($error eq 'banned') {
print "\n";
print "
\n";
print " \n";
print " \n";
print " You are Banned! \n";
print "\n";
print "
\n";
print "$header\n";
print "".$headerfont."You are Banned! \n";
print "$forumline
\n";
print "Your message has NOT been added!
\n";
&print_credits;
}
elsif ($error eq 'already_moderated') {
print "\n";
print "
\n";
print " \n";
print " \n";
print " Message Already Moderated \n";
print "\n";
print "
\n";
print "$header\n";
print "".$headerfont."Can't Moderate Twice \n";
print "$forumline
\n";
print "The message has already been moderated by you. You can't moderate the same message twice.
\n";
print "Go Back to the Message ";
print "Back to $title ";
&print_credits;
}
elsif ($error eq 'moderated') {
print "\n";
print "
\n";
print " \n";
print " \n";
print " Message Moderated \n";
print "\n";
print "
\n";
print "$header\n";
print "".$headerfont."Message Moderated \n";
print "$forumline
\n";
print "The message has been moderated.
\n";
print "Go Back to the Message ";
print "Back to $title ";
&print_credits;
}
elsif ($error eq 'success') {
print "\n";
print "
\n";
print " \n";
print " \n";
print " \n";
print " Message Added \n";
print "\n";
print "
\n";
print "$header\n";
print "".$headerfont."Message Added \n";
print "$forumline
\n";
print "Thank you. Your message has been added.
\n";
print "View Your Message ";
print "Back to $title ";
&print_credits;
}
exit;
}
$temp = "!";
##############################################################################
# RPGBoard Global code version 2.10a #
# Copyleft 1999 Brendan Byrd and Resonator Software #
# Contact me at: sineswiper@resonatorsoft.com #
##############################################################################
require 5.004;
$gmt_epoch = time;
@labels = ("Automatic", "4 hours ago", "8 hours ago", "12 hours ago", "1 day ago", "2 days ago", "3 days ago", "4 days ago", "5 days ago", "1 week ago", "2 weeks ago", "3 weeks ago", "1 month ago", "2 months ago", "3 months ago", "6 months ago", "1 year ago", "Everything");
@expirevalues = (-1, 4, 8, 12, 24, 48, 72, 96, 120, 168, 336, 504, 720, 1440, 2160, 4320, 8760, 100000);
@months = ("","January","February","March","April","May","June","July","August","September","October","November","December");
@weekdays = ("","Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday");
# Roxen QUERY_STRING fix
if ($ENV{'SERVER_SOFTWARE'} =~ /Roxen/) { $ENV{'QUERY_STRING'} = $ENV{'INDEX'}; }
if ($ENV{'QUERY_STRING'} eq "\@\@TRANSPARENT\@\@") { &print_transparent; }
if (-d $basedir) {
($z,$z,$z,$z,$uid,$gid,$z,$z,$z,$z,$z,$z,$z) = stat($basedir);
if ($uid == $< && $gid == $() { $chmod_num = 0644; } else { $chmod_num = 0666; }
}
else { $chmod_num = 0666; }
###########################
# Set "Default" background
$bkgrndname[0] = "Default";
$bkgrndfile[0] = "$standardbg";
$textcolor[0] = "$textcolor";
$bgcolor[0] = "$bgcolor";
$linkcolor[0] = "$linkcolor";
$vlinkcolor[0] = "$vlinkcolor";
$bgtype = 0;
$msgtag{'N'} = "No Text";
$msgtagcolor{'N'} = "$notextcolor";
$msgtagorder = $msgtagorder."N";
#########################
# Get standard variables
$title = $title{'Default'};
if ($ENV{'QUERY_STRING'} =~ /([^\;]*)\;([0-9A-F]{16})(.?)/) {
$forum = $1;
$querydate = &hex2dec(substr($2, 0, 8));
$querynum = &hex2dec(substr($2, 8, 8));
$special_option = $3;
}
else {
$forum = $ENV{'QUERY_STRING'};
}
if ($forum && !$mesgdir{$forum} && ($ENV{'SCRIPT_NAME'} eq $rpgboard_uri || $ENV{'SCRIPT_NAME'} eq $rpgheaders_uri)) { &tech_error("Forum ID \"$forum\" doesn't exist! Forum IDs that -do- exist are:\n\n".join("\n", keys %mesgdir)); }
$title = $title{$forum} if ($title{$forum});
$expire_time = $expire_time{$forum} if ($expire_time{$forum});
$indexfile = $indexfile{$forum} if ($indexfile{$forum});
$mesgdir = $mesgdir{$forum} if ($mesgdir{$forum});
$option = $option{$forum} if ($option{$forum});
############################
# Deal with root-based URIs
if ($baseuri eq "/") { $root_baseuri = 1; undef $baseuri; }
######################
# Grab form variables
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
push(@pairs, split(/&/, $buffer));
push(@pairs, split(/&/, $ENV{'QUERY_STRING_UNESCAPED'}));
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$name =~ tr/+/ /;
$name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$FORM{$name} = $value;
}
#############################################
# Check header/footer/counter files (if any)
$headervar = $header;
$footervar = $footer;
$countervar = $counter;
if ($header =~ /^([file|exec]+):(.+)$/) {
if ($1 eq "file") { open(HEADER,$2); } else { open(HEADER,"$2 |"); }
$header = "\n".join('',)."\n";
close(HEADER);
if ($1 eq "exec") { $header =~ s/^Content-type:.+?\n\n//ms; }
}
if ($footer =~ /^([file|exec]+):(.+)$/) {
if ($1 eq "file") { open(FOOTER,$2); } else { open(FOOTER,"$2 |"); }
$footer = "\n".join('',)."\n";
close(FOOTER);
if ($1 eq "exec") { $footer =~ s/^Content-type:.+?\n\n//ms; }
}
if ($counter =~ /^([file|exec]+):(.+)$/) {
if ($1 eq "file") { open(COUNTER,$2); } else { open(COUNTER,"$2 |"); }
$counter = "\n".join('',)."\n";
close(COUNTER);
if ($1 eq "exec") { $counter =~ s/^Content-type:.+?\n\n//ms; }
}
############################
# Get the IP address/number
if ($ENV{'REMOTE_HOST'} && $ENV{'REMOTE_ADDR'} ne $ENV{'REMOTE_HOST'}) { $remotehost = $ENV{'REMOTE_HOST'}; }
elsif ($ENV{'REMOTE_ADDR'} && -x "/usr/bin/nslookup") {
open(REVIPLOOKUP,"/usr/bin/nslookup $ENV{'REMOTE_ADDR'} 2> /dev/null |");
@reviplookup = ;
close(REVIPLOOKUP);
foreach $nslookup_line (@reviplookup) { $remotehost = $1 if ($nslookup_line =~ /^Name\: (.+)/); }
unless ($remotehost) { $remotehost = "???"; }
}
else { $remotehost = "???"; }
if ($remotehost eq "???" && $ENV{'HTTP_VIA'}) {
while ($ENV{'HTTP_VIA'} =~ /[0-9\.]+ (.+?):[0-9]+/gc) { $remotehost = $1; }
}
##############
# Get cookies
@pairs = split(/\; /, $ENV{'HTTP_COOKIE'});
foreach $pair (@pairs) {
($cookie, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$COOKIE{$cookie} = $value;
}
# Roxen cookie fix
if (!$ENV{'HTTP_COOKIE'} && $ENV{'SERVER_SOFTWARE'} =~ /Roxen/) {
foreach $key (grep { /^COOKIE\_/ } keys %ENV) {
$cookie = substr($key, 7);
$COOKIE{$cookie} = $ENV{$key};
}
}
unless ($COOKIE{'LastPostDate'} && $COOKIE{'NoUpdate'}) {
$COOKIE{'LastPostDate'} = $COOKIE{'CurrentPostDate'};
}
unless ($COOKIE{'CurrentPostDate'} && $COOKIE{'NoUpdate'}) {
$COOKIE{'CurrentPostDate'} = $gmt_epoch;
}
unless ($COOKIE{'LastPostDate'}) {
$COOKIE{'LastPostDate'} = $COOKIE{'CurrentPostDate'};
}
if ($COOKIE{'Name'}) { $name = $COOKIE{'Name'}; }
######################
# Time zone variables
$timezone_name{"-1200"} = "International Date Line West";
$timezone_name{"-1100"} = "Nome Time";
$timezone_name{"-1000"} = "Alaska-Hawaii Standard Time";
$timezone_name{"-0900"} = "Yukon Standard Time";
$timezone_name{"-0800"} = "Pacific Standard Time";
$timezone_name{"-0700"} = "Mountain Standard Time";
$timezone_name{"-0600"} = "Central Standard Time";
$timezone_name{"-0500"} = "Eastern Standard Time";
$timezone_name{"-0400"} = "Atlantic Standard Time";
$timezone_name{"-0330"} = "Newfoundland Time";
$timezone_name{"-0300"} = "Brazil Standard Time";
$timezone_name{"-0200"} = "Azores Time";
$timezone_name{"-0100"} = "West Africa Time";
$timezone_name{" 0000"} = "Greenwich Mean Time";
$timezone_name{"+0100"} = "Central Euporean Time";
$timezone_name{"+0200"} = "Eastern Euporean Time";
$timezone_name{"+0300"} = "Baghdad Time";
$timezone_name{"+0330"} = "Iran Time";
$timezone_name{"+0400"} = "Russia Zone 3";
$timezone_name{"+0500"} = "Russia Zone 4";
$timezone_name{"+0530"} = "Indian Standard Time";
$timezone_name{"+0600"} = "Russia Zone 5";
$timezone_name{"+0630"} = "North Sumatra Time";
$timezone_name{"+0700"} = "West Australian Standard Time";
$timezone_name{"+0730"} = "Java Time";
$timezone_name{"+0800"} = "China Coast Time";
$timezone_name{"+0900"} = "Japan Standard Time";
$timezone_name{"+0930"} = "Central Australian Standard Time";
$timezone_name{"+1000"} = "Eastern Australian Standard Time";
$timezone_name{"+1200"} = "International Date Line East";
$timezone_name{"-1000D"} = "Hawaii Daylight Time";
$timezone_name{"-0900D"} = "Yukon Daylight Time";
$timezone_name{"-0800D"} = "Pacific Daylight Time";
$timezone_name{"-0700D"} = "Mountain Daylight Time";
$timezone_name{"-0600D"} = "Central Daylight Time";
$timezone_name{"-0500D"} = "Eastern Daylight Time";
$timezone_name{"-0400D"} = "Atlantic Daylight Time";
$timezone_name{"-0330D"} = "Newfoundland Daylight Time";
$timezone_name{" 0000D"} = "GMT with daylight savings";
$timezone_name{"+0100D"} = "Central Euporean Summer Time";
$timezone_name{"+0200D"} = "Eastern Euporean Summer Time";
$timezone_name{"+0930D"} = "Central Australian Daylight Time";
$timezone_name{"+1000D"} = "Eastern Australian Daylight Time";
$timezone_name{"+1200D"} = "New Zealand Daylight Time";
$timezone_abbr{"-1200"} = "IDLW";
$timezone_abbr{"-1100"} = "NT";
$timezone_abbr{"-1000"} = "AHST";
$timezone_abbr{"-0900"} = "YST";
$timezone_abbr{"-0800"} = "PST";
$timezone_abbr{"-0700"} = "MST";
$timezone_abbr{"-0600"} = "CST";
$timezone_abbr{"-0500"} = "EST";
$timezone_abbr{"-0400"} = "AST";
$timezone_abbr{"-0330"} = "NFT";
$timezone_abbr{"-0300"} = "BST";
$timezone_abbr{"-0200"} = "AT";
$timezone_abbr{"-0100"} = "WAT";
$timezone_abbr{" 0000"} = "GMT";
$timezone_abbr{"+0100"} = "CET";
$timezone_abbr{"+0200"} = "EET";
$timezone_abbr{"+0300"} = "BT";
$timezone_abbr{"+0330"} = "IT";
$timezone_abbr{"+0400"} = "ZP4";
$timezone_abbr{"+0500"} = "ZP5";
$timezone_abbr{"+0530"} = "IST";
$timezone_abbr{"+0600"} = "ZP6";
$timezone_abbr{"+0630"} = "NST";
$timezone_abbr{"+0700"} = "WAST";
$timezone_abbr{"+0730"} = "JT";
$timezone_abbr{"+0800"} = "CCT";
$timezone_abbr{"+0900"} = "JST";
$timezone_abbr{"+0930"} = "CAST";
$timezone_abbr{"+1000"} = "EAST";
$timezone_abbr{"+1200"} = "IDLE";
$timezone_abbr{"-1000D"} = "HDT";
$timezone_abbr{"-0900D"} = "YDT";
$timezone_abbr{"-0800D"} = "PDT";
$timezone_abbr{"-0700D"} = "MDT";
$timezone_abbr{"-0600D"} = "CDT";
$timezone_abbr{"-0500D"} = "EDT";
$timezone_abbr{"-0400D"} = "ADT";
$timezone_abbr{"-0330D"} = "NDT";
$timezone_abbr{" 0000D"} = "GB";
$timezone_abbr{"+0100D"} = "CEST";
$timezone_abbr{"+0200D"} = "EEST";
$timezone_abbr{"+0930D"} = "CADT";
$timezone_abbr{"+1000D"} = "EADT";
$timezone_abbr{"+1200D"} = "NZDT";
#################
# Character sets
$charset_name{"US-ASCII"} = "Standard US ASCII set";
$charset_name{"ISO-8859-1"} = "Latin 1; Western European Languages including English";
$charset_name{"ISO-8859-2"} = "Latin 2; Slavic/Central European Languages";
$charset_name{"ISO-8859-3"} = "Latin 3; Esperanto, Galician, Maltese, Turkish";
$charset_name{"ISO-8859-4"} = "Latin 4; Estonian, Latvian, Lithuanian";
$charset_name{"ISO-8859-5"} = "Cyrillic";
$charset_name{"ISO-8859-6"} = "Arabic";
$charset_name{"ISO-8859-7"} = "Modern Greek";
$charset_name{"ISO-8859-8"} = "Hebrew";
$charset_name{"ISO-8859-9"} = "Latin 5; Turkish";
$charset_name{"ISO-8859-15"} = "Latin 9; Western European Languages with Euro";
$charset_name{"KOI8-R"} = "Russian";
$charset_name{"EUC-JP"} = "Standard Japanese";
$charset_name{"SHIFT_JIS"} = "Japanese with Kanji";
$charset_name{"CN-GB-12345"} = "Chinese for mainland China";
$charset_name{"CN-BIG5"} = "Chinese with standard Taiwan set";
$charset_name{"CN-GB-ISOIR165"} = "CCITT Chinese set";
$charset_name{"UTF-8"} = "Universal Character Set Transformation Format; 8 bit";
$charset_name{"UTF-16"} = "Universal Character Set Transformation Format; 16 bit";
$charset_name{"UNICODE-1-1"} = "Unicode 1.1 aka UCS-2";
@charset_order = ("US-ASCII", "ISO-8859-1","ISO-8859-2","ISO-8859-3","ISO-8859-4",
"ISO-8859-5","ISO-8859-6","ISO-8859-7","ISO-8859-8","ISO-8859-9",
"ISO-8859-15","KOI8-R","EUC-JP","SHIFT_JIS","CN-GB-12345","CN-BIG5",
"CN-GB-ISOIR165","UTF-8","UTF-16","UNICODE-1-1");
########################
# Common subroutines #
########################
sub read_datefile {
$year = substr($_[0], 0, 4);
$month = substr($_[0], 4, 2);
$day = substr($_[0], 6, 2);
$extfile = substr($_[0], 8);
if (-e "$basedir/$mesgdir/$year$month$day$extfile") {
return "$basedir/$mesgdir/$year$month$day$extfile";
}
elsif (-e "$basedir/$mesgdir/$year$month$day$extfile.gz") {
return "/bin/gzip -cd $basedir/$mesgdir/$year$month$day$extfile.gz |";
}
elsif (-e "$basedir/$mesgdir/$year$month$day$extfile.bz2") {
return "/usr/bin/bzip2 -cd $basedir/$mesgdir/$year$month$day$extfile.bz2 |";
}
elsif (-e "$basedir/$mesgdir/$year$month$extfile") {
return "$basedir/$mesgdir/$year$month$extfile";
}
elsif (-e "$basedir/$mesgdir/$year$month$extfile.gz") {
return "/bin/gzip -cd $basedir/$mesgdir/$year$month$extfile.gz |";
}
elsif (-e "$basedir/$mesgdir/$year$month$extfile.bz2") {
return "/usr/bin/bzip2 -cd $basedir/$mesgdir/$year$month$extfile.bz2 |";
}
elsif (-e "$basedir/$mesgdir/$year$extfile") {
return "$basedir/$mesgdir/$year$extfile";
}
elsif (-e "$basedir/$mesgdir/$year$extfile.gz") {
return "/bin/gzip -cd $basedir/$mesgdir/$year$extfile.gz |";
}
elsif (-e "$basedir/$mesgdir/$year$extfile.bz2") {
return "/usr/bin/bzip2 -cd $basedir/$mesgdir/$year$extfile.bz2 |";
}
else {
&tech_error("Can't find file for $year$month$day$extfile while reading!");
}
}
sub write_datefile {
$year = substr($_[0], 0, 4);
$month = substr($_[0], 4, 2);
$day = substr($_[0], 6, 2);
$extfile = substr($_[0], 8);
if (-e "$basedir/$mesgdir/$year$month$day$extfile") {
return ">$basedir/$mesgdir/$year$month$day$extfile";
}
elsif (-e "$basedir/$mesgdir/$year$month$day$extfile.gz") {
return "|/bin/gzip -cf > $basedir/$mesgdir/$year$month$dat$extfile.gz";
}
elsif (-e "$basedir/$mesgdir/$year$month$day$extfile.bz2") {
return "|/usr/bin/bzip2 -cf > $basedir/$mesgdir/$year$month$dat$extfile.bz2";
}
elsif (-e "$basedir/$mesgdir/$year$month$extfile") {
return ">$basedir/$mesgdir/$year$month$extfile";
}
elsif (-e "$basedir/$mesgdir/$year$month$extfile.gz") {
return "|/bin/gzip -cf > $basedir/$mesgdir/$year$month$extfile.gz";
}
elsif (-e "$basedir/$mesgdir/$year$month$extfile.bz2") {
return "|/usr/bin/bzip2 -cf > $basedir/$mesgdir/$year$month$extfile.bz2";
}
elsif (-e "$basedir/$mesgdir/$year$extfile") {
return ">$basedir/$mesgdir/$year$extfile";
}
elsif (-e "$basedir/$mesgdir/$year$extfile.gz") {
return "|/bin/gzip -cf > $basedir/$mesgdir/$year$extfile.gz";
}
elsif (-e "$basedir/$mesgdir/$year$extfile.bz2") {
return "|/usr/bin/bzip2 -cf > $basedir/$mesgdir/$year$extfile.bz2";
}
else {
&tech_error("Can't find file for $year$month$day$extfile while writing!");
}
}
sub lock_datefile {
$year = substr($_[0], 0, 4);
$month = substr($_[0], 4, 2);
$day = substr($_[0], 6, 2);
$extfile = substr($_[0], 8);
if (-e "$basedir/$mesgdir/$year$month$day$extfile.lock") {
($z,$z,$z,$z,$z,$z,$z,$z,$z,$mtime,$z,$z,$z) = stat("$basedir/$mesgdir/$year$month$day$extfile.lock");
if ($mtime < $gmt_epoch - 900) { &unlock_datefile("$year$month$day$extfile"); }
}
elsif (-e "$basedir/$mesgdir/$year$month$extfile.lock") {
($z,$z,$z,$z,$z,$z,$z,$z,$z,$mtime,$z,$z,$z) = stat("$basedir/$mesgdir/$year$month$extfile.lock");
if ($mtime < $gmt_epoch - 900) { &unlock_datefile("$year$month$day$extfile"); }
}
elsif (-e "$basedir/$mesgdir/$year$extfile.lock") {
($z,$z,$z,$z,$z,$z,$z,$z,$z,$mtime,$z,$z,$z) = stat("$basedir/$mesgdir/$year$extfile.lock");
if ($mtime < $gmt_epoch - 900) { &unlock_datefile("$year$month$day$extfile"); }
}
$r = 0;
while(++$r) {
unless (-e "$basedir/$mesgdir/$year$month$day$extfile.lock" ||
-e "$basedir/$mesgdir/$year$month$extfile.lock" ||
-e "$basedir/$mesgdir/$year$extfile.lock") { last; }
if ($r > 100000) { &unlock_datefile("$year$month$day$extfile"); }
};
if (-e "$basedir/$mesgdir/$year$extfile") { $s = "$basedir/$mesgdir/$year$extfile"; }
elsif (-e "$basedir/$mesgdir/$year$extfile.gz") { $s = "$basedir/$mesgdir/$year$extfile.gz"; }
elsif (-e "$basedir/$mesgdir/$year$extfile.bz2") { $s = "$basedir/$mesgdir/$year$extfile.bz2"; }
elsif (-e "$basedir/$mesgdir/$year$month$extfile") { $s = "$basedir/$mesgdir/$year$month$extfile"; }
elsif (-e "$basedir/$mesgdir/$year$month$extfile.gz") { $s = "$basedir/$mesgdir/$year$month$extfile.gz"; }
elsif (-e "$basedir/$mesgdir/$year$month$extfile.bz2") { $s = "$basedir/$mesgdir/$year$month$extfile.bz2"; }
elsif (-e "$basedir/$mesgdir/$year$month$day$extfile") { $s = "$basedir/$mesgdir/$year$month$day$extfile"; }
elsif (-e "$basedir/$mesgdir/$year$month$day$extfile.gz") { $s = "$basedir/$mesgdir/$year$month$day$extfile.gz"; }
elsif (-e "$basedir/$mesgdir/$year$month$day$extfile.bz2") { $s = "$basedir/$mesgdir/$year$month$day$extfile.bz2"; }
else { &tech_error("Can't find file for $year$month$day$extfile while locking!"); }
# First try (to check for disk space)
open (LOCKFILE, ">$s.lock") || &tech_error("Can't create $s.lock!");
print (LOCKFILE "\0" x 65536) || &tech_error("Can't print to $s.lock! (Possibly out of disk space)");
close(LOCKFILE);
# Second try (bring lock file back to 0 bytes)
open (LOCKFILE, ">$s.lock") || &tech_error("Can't create second $s.lock!");
close(LOCKFILE);
return $_[0];
}
sub unlock_datefile {
$year = substr($_[0], 0, 4);
$month = substr($_[0], 4, 2);
$day = substr($_[0], 6, 2);
$extfile = substr($_[0], 8);
if (-e "$basedir/$mesgdir/$year$month$day$extfile.lock") {
unlink ("$basedir/$mesgdir/$year$month$day$extfile.lock");
}
if (-e "$basedir/$mesgdir/$year$month$extfile.lock") {
unlink ("$basedir/$mesgdir/$year$month$extfile.lock");
}
if (-e "$basedir/$mesgdir/$year$extfile.lock") {
unlink ("$basedir/$mesgdir/$year$extfile.lock");
}
return $_[0];
}
sub hex2dec {
return unpack("N", pack("H8", substr("0" x 8 . $_[0], -8)));
}
sub dec2hex {
return uc(unpack("H8", pack("N", $_[0])));
}
sub get_browser_info {
if ($_[0] =~ /(.*) \((.*)\)\ ?(.*)/) {
$browser = $1;
$os = $2;
$extrainfo = $3;
}
else {
$browser = $_[0];
}
if ($browser =~ /(.*) \[.*\]/) {
$browser = $1;
$language = $2;
}
if ($os =~ /AOL ([\d\.ab]+)/) { $browser = "AOL Browser V$1"; }
elsif ($os =~ /AOL-IWENG ([\d\.ab]+)/) { $browser = "AOL Browser V$1"; }
elsif ($os =~ /MSIE ([\d\.ab]+)/) {
if ($browser =~ /Mozilla\/[\d\.ab]+ WebTV\/([\d\.ab]+)/) { $os = "WebTV V$1"; }
$browser = "Microsoft Internet Explorer V$1";
}
elsif ($os =~ /Opera\/([\d\.ab]+)/) { $browser = "Opera V$extrainfo"; }
elsif ($extrainfo =~ /Opera ([\d\.]+)/) { $browser = "Opera V$1"; }
elsif ($browser =~ /Mozilla\// && $os =~ /compatible\; (.*?)\; .*/) { $browser = "$1"; }
elsif ($browser =~ /Mozilla\/([\d\.ab]+)Gold/) { $browser = "Netscape Navigator V$1 Gold"; }
elsif ($browser =~ /Mozilla\/([\d\.ab]+)$/ && $os =~ /.*\; \; .*\;\s*Nav/) { $browser = "Mozilla Browser V$1"; }
elsif ($browser =~ /Mozilla\/([\d\.ab]+)$/ && $os =~ /.*\; .*\; .*\;\s*Nav/) { $browser = "Netscape Navigator V$1"; }
elsif ($browser =~ /Mozilla\/([\d\.ab]+)/ && $os =~ /.*\; .*\; .*\;\s*Nav/) { $browser = "Netscape Navigator V$1 Custom"; }
elsif ($browser =~ /Mozilla\/([\d\.ab]+)$/) {
if (substr($1,0,1) eq "2" || substr($1,0,1) eq "3") { $browser = "Netscape Navigator V$1"; }
else { $browser = "Netscape Communicator V$1"; }
}
elsif ($browser =~ /Mozilla\/([\d\.ab]+)/) { $browser = "Netscape Navigator V$1 Custom"; }
elsif ($browser =~ /Lynx\/(\S+)/) {
$browser = "Lynx V$1";
$os = "UNIX";
}
elsif ($browser =~ /(.+?)\/(\S+)/) { $browser = "$1 V$2"; }
if ($os eq "TuringOS; Turing Machine; 0.0") {
$browser = "[Blocked by Anonymizer]";
$os = "[Blocked by Anonymizer]";
}
elsif ($os =~ /Windows ([^\;]*)/) {
if ($1 eq "x86" || $1 eq "16") { $os = "Windows 3.1"; }
elsif ($1 eq "32") { $os = "Windows 95/98/NT"; }
elsif ($1 eq "4.10") { $os = "Windows 98"; }
else { $os = "Windows $1"; }
}
elsif ($os =~ /Win([^\;]*)/) {
if ($1 eq "x86" || $1 eq "16") { $os = "Windows 3.1"; }
elsif ($1 eq "32") { $os = "Windows 95/98/NT"; }
elsif ($1 eq "4.10") { $os = "Windows 98"; }
else { $os = "Windows $1"; }
}
elsif ($os =~ /Mac_PPC/ || $os =~ /Macintosh\;.*PPC/) { $os = "Macintosh PowerPC"; }
elsif ($os =~ /Macintosh\;.*68K/) { $os = "Macintosh (68K)"; }
elsif ($os =~ /Mac/) { $os = "Macintosh"; }
elsif ($os =~ /X11\; .*\; Linux (\S*) ([^\;]*)/) {
$os = "XWindows/Linux $1";
if ($2 eq "i586") { $os = $os." (Pentium)"; }
elsif ($2 eq "i686") { $os = $os." (Pentium Pro)"; }
elsif ($2 eq "i786") { $os = $os." (Pentium 2)"; }
elsif ($2 =~ /i(.*)/) { $os = $os." ($1)"; }
else { $os = $os." ($2)"; }
}
elsif ($os =~ /X11\; .*\; (\S*) (\S*)/) { $os = "XWindows/$1 $2"; }
elsif ($os =~ /SEGA Saturn/) { $os = "Sega Saturn"; }
elsif ($os =~ /DreamPassport/) { $browser = "DreamPassport"; $os = "Sega Dreamcast"; }
elsif ($os =~ /compatible\; .*?\; (.*)/) { $os = "$1"; }
elsif (!($os)) { $os = "[Unknown OS]"; }
if ($language eq "ja") { $browser = $browser." (Japanese)"; }
elsif ($language ne "en" && $language) { $browser = $browser." ($language)"; }
if ($browser eq "Mozilla") {
$browser = "[Blocked by Junkbuster]";
$os = "[Blocked by Junkbuster]";
}
return "$browser using $os";
}
sub convert_date {
$cd_gmt = $_[0];
$cd_diff = ($gmt_epoch - $cd_gmt);
$cd_timezone = $_[1];
$cd_datemode = $_[2];
if ($cd_timezone =~ /(.*)D$/) { $cd_timezone = substr($cd_timezone, 0, -1) + 100; }
if (substr($cd_timezone, -2) eq "30") { $cd_timezone = substr($cd_timezone, 0, -2)."50"; }
($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = gmtime($cd_gmt + $cd_timezone * 36);
$sec = "0$sec" if ($sec < 10);
$min = "0$min" if ($min < 10);
$mon++;
$wday++;
$year += 1900;
unless ($cd_datemode) { # yyyymmdd (internal use only)
$mon = "0$mon" if ($mon < 10);
$mday = "0$mday" if ($mday < 10);
return "$year$mon$mday";
}
elsif ($cd_datemode == -1) { # Cookie date format (internal use only)
$hour = "0$hour" if ($hour < 10);
$mday = "0$mday" if ($mday < 10);
return substr($weekdays[$wday], 0, 3).", $mday-".substr($months[$mon], 0, 3)."-$year $hour:$min:$sec GMT";
}
# Datemode breakdown
#
# 1st # - Weekday ("Sun", "Sunday")
# 2nd # - Month/Day ("m/d/yyyy", "d/m/yyyy", "Month d, yyyy", "d Mon yyyy")
# 3rd # - Seconds ("", ":ss")
# 4th # - Hour ("", "PM")
# 5th # - Time Zone ("EST", "-0500")
# 6th # - Use string compression?
if (substr($cd_datemode, 0, 1) < 2) { $weekday = substr($weekdays[$wday], 0, 3); }
else { $weekday = $weekdays[$wday]; }
if (substr($cd_datemode, 1, 1) < 2) { $monthday = "$mon/$mday"; $yearstr = "/$year"; }
elsif (substr($cd_datemode, 1, 1) == 2) { $monthday = "$mday/$mon"; $yearstr = "/$year"; }
elsif (substr($cd_datemode, 1, 1) == 3) { $monthday = "$months[$mon] $mday"; $yearstr = ", $year"; }
else { $monthday = "$mday ".substr($months[$mon], 0, 3); $yearstr = " $year"; }
unless (substr($cd_datemode, 2, 1) < 2) { $secstr = ":$sec"; }
else { undef $secstr; }
unless (substr($cd_datemode, 3, 1) < 2) {
if ($hour > 12) { $hour -= 12; $time_ext = " PM"; }
else { $hour = 12 if ($hour == 0); $time_ext = " AM"; }
}
else { undef $time_ext; }
$timestr = "$hour:$min$secstr$time_ext";
if (substr($cd_datemode, 4, 1) < 2) { $tzstr = $timezone_abbr{$_[1]}; }
else { $tzstr = $_[1]; }
if (substr($cd_datemode, 5, 1)) {
unless ($cd_diff) { # No difference (rare)
return "Now";
}
elsif ($cd_diff == 1) { # 1 second
return "1 second ago";
}
elsif ($cd_diff < 60) { # Less than a minute
return "$cd_diff seconds ago";
}
elsif ((substr($cd_datemode, 2, 1) < 2) &&
$cd_diff < 120) { # 1 minute
return "1 minute ago";
}
elsif ((substr($cd_datemode, 2, 1) < 2) &&
$cd_diff < 3600) { # Less than a hour
return int($cd_diff / 60)." minutes ago";
}
elsif ($cd_diff < 86400) { # Less than a day
return $timestr;
}
elsif ($cd_diff < 604800) { # Less than a week
return "$weekday $timestr";
}
elsif ($cd_diff < 31536000) { # Less than a year
return "$monthday @ $timestr";
}
else {
return "$monthday$yearstr @ $timestr";
}
}
else {
return "$weekday, $monthday$yearstr at $timestr $tzstr";
}
}
sub calc_expire_time {
if ($expire_time != -1) { return; }
opendir(INDEXLIST,"$basedir/$mesgdir") || &tech_error("Can't open listing for $basedir/$mesgdir while displaying headers!");
@indexlist = reverse sort grep { /\.index(?:\.gz|\.bz2)?$/ } readdir(INDEXLIST);
closedir(INDEXLIST);
foreach $indexfile (@indexlist) {
if ($indexfile =~ /(\d*)\.index/) {
$filedate = $1;
if (length($filedate) == 4) { $filedate = $filedate."9999"; }
elsif (length($filedate) == 6) { $filedate = $filedate."99"; }
else { $filedate = $filedate; }
open(INDEXFILE,&read_datefile("$filedate.index")) || &tech_error("Can't read $filedate.index while calculating expire time! (Read method: ".&read_datefile("$filedate.index").")");
@headers = ;
close(INDEXFILE);
for ($r = 0; $r < @headers; $r++) {
if ($headers[$r] =~ /^([\ ]*)(\d+)\xff(.+)\xff(.?)\xff(.*)\xff(.+)\xff(\d+)(D|M[-\+]+\d+)?$/) {
$spaces = $1; $headerdate = $2; $headersubject = $3; $headertag = $4;
$headersection = $5; $headername = $6; $headernum = $7; $headeroption = $8;
$headerbytes += length($headersubject) + length($headersection) + length($headername);
if (length($spaces) == 0 && $headerbytes > 6000) {
for ($s = 0; $s < @labels; $s++) {
if ((($gmt_epoch - $headerdate) / 3600) < $expirevalues[$s]) { $expire_time = $expirevalues[$s]; return; }
}
}
}
}
}
}
$expire_time = 100000;
}
sub get_default {
undef %stats_ip; undef %stats_browser;
undef %stats_msgs; undef %stats_ntmsgs; undef %stats_words;
undef $sex; undef $date_of_birth;
$defaultname = lc($name);
if ($name ne "!!default") { $defaultname =~ s/\W//g; }
$filename = "$basedir/$defaultdir/$defaultname.txt";
unless (-e $filename) { return; }
else { $recordfound = "yes"; }
open(DEFAULT,"$filename") || return;
@default = ;
close(DEFAULT);
unless ($msgwidth) { $msgwidth = $basemsgwidth; }
for ($r = 0; $default[$r] ne "\xff\xff\xff\n" && $r < @default; $r++) {
if ($default[$r] =~ /^Name: (.*)\n/) { $name = $1; next; }
if ($default[$r] =~ /^Password: (.*)\n/) { $password = $1; next; }
if ($default[$r] =~ /^E-Mail: (.*)\n/) { $email = $1; next; }
if ($default[$r] =~ /^Font Face: (.*)\n/) { $fontface = $1; next; }
if ($default[$r] =~ /^Font Color: (.*)\n/) { $fontcolor = $1; next; }
if ($default[$r] =~ /^Font Size: (.*)\n/) { $fontsize = $1; next; }
if ($default[$r] =~ /^Background: (.*)\n/ && !($bgtype)) { $bgtype = $1; next; }
if ($default[$r] =~ /^Time Zone: (.*)\n/) { $timezone = $1; next; }
if ($default[$r] =~ /^Date Mode: (\d{5})\n/) { $datemode = $1; next; }
if ($default[$r] =~ /^Cookie Expire: (.*)\n/) { $cookieexpire = $1; next; }
if ($default[$r] =~ /^Collapse Threads: (.*)\n/) { $collapse_threads = $1; next; }
if ($default[$r] =~ /^Message Threads: (.*)\n/) { $message_threads = $1; next; }
if ($default[$r] =~ /^Header Style: (.*)\n/) { $header_style = $1; next; }
if ($default[$r] =~ /^Submit State: (.*)\n/) { $submit_state = $1; next; }
if ($default[$r] =~ /^Screen Size: (.*)\n/) {
$screensize = $1;
$msgwidth = $basemsgwidth + $1;
next;
}
if ($default[$r] =~ /^View Deleted: (.*)\n/) { $view_deleted = $1; next; }
if ($default[$r] =~ /^View Sigs: (.*)\n/) { $view_sigs = $1; next; }
if ($default[$r] =~ /^Auto-Save: (.*)\n/) { $auto_save = $1; next; }
if ($default[$r] =~ /^Message Threshold: (.*)\n/) { $msg_threshold = $1; next; }
if ($default[$r] =~ /^Ignore List: (.*)\n/) {
@ignore_list = split(/\xff/, $1);
for ($s = 0; $s < @ignore_list; $s++) {
if ($ignore_list[$s] =~ /(.+) <(.+)>/) { $ignore_name[$s] = $1; $ignore_forum[$s] = $2; }
else { $ignore_name[$s] = $ignore_list[$s]; }
}
undef @ignore_list;
next;
}
if ($default[$r] =~ /^Footer: (.*)\n/) { $footerbody = $1; $footerbody =~ s/\\n/\n/g; next; }
if ($default[$r] =~ /^Real Name: (.*)\n/) { $realname = $1; next; }
if ($default[$r] =~ /^Sex: (.*)\n/) { $sex = $1; next; }
if ($default[$r] =~ /^Date of Birth: (.*)\n/) { $date_of_birth = $1; next; }
if ($default[$r] =~ /^Current Residence: (.*)\n/) { $current_residence = $1; next; }
if ($default[$r] =~ /^Occupation: (.*)\n/) { $occupation = $1; next; }
if ($default[$r] =~ /^Home Page: (.*)\n/) { $homepage = $1; next; }
if ($default[$r] =~ /^Interests: (.*)\n/) { $interests = $1; next; }
for ($s = 1; $s < @custom_entry_description; $s++) {
if ($default[$r] =~ /^Custom Entry \#$s: (.*)\n/) { $custom_entry[$s] = $1; next; }
}
if ($default[$r] =~ /^Portrait: (.*)\n/) { $portrait = $1; next; }
if ($default[$r] =~ /^Description: (.*)\n/) { $description = $1; next; }
if ($default[$r] =~ /^First Post Date: (.*)\n/) { $first_post_date = $1; next; }
if ($default[$r] =~ /^Last Post Subject: (.*)\n/) { $last_post_subject = $1; next; }
if ($default[$r] =~ /^Last Post Info: (.*)\/(.*)\/(.*)\n/) {
$last_post_msg = $1;
$last_post_forum = $2;
$last_post_date = $3;
}
if ($default[$r] =~ /^Moderated Messages: (.*)\n/) {
@s = split(/\xff/, $1);
foreach $t (@s) {
($u,$v) = split(/\;/, $t);
if ($expire_time{$u} == -1) {
if ($forum ne $u || (($gmt_epoch - $expire_time * 3600) < &hex2dec(substr($v, 0, 8)))) { $moderated{$u.";".&hex2dec(substr($v, 8, 8))} = &hex2dec(substr($v, 0, 8)); }
}
else {
if (($gmt_epoch - $expire_time{$u} * 3600) < &hex2dec(substr($v, 0, 8))) { $moderated{$u.";".&hex2dec(substr($v, 8, 8))} = &hex2dec(substr($v, 0, 8)); }
}
}
undef @s;
}
}
for ($s = 1; $s <= 10; $s++) {
if ($default[$r+$s] =~ /(.*) = (.*)\n/) { $stats_ip{$1} = $2; }
}
for ($r += 10, $s = 1; $s <= 10; $s++) {
if ($default[$r+$s] =~ /(.*) = (.*)\n/) { $stats_browser{$1} = $2; }
}
for ($r += 11; $default[$r] ne "\xff\xff\xff\n" && $r < @default; $r++) {
if ($default[$r] =~ /(.*): (.*)\/(.*)\/(.*)\n/) {
$stats_msgs{$1} = $2;
$stats_ntmsgs{$1} = $3;
$stats_words{$1} = $4;
}
}
}
sub add_default {
unless ($password || $action eq "add_default") { return; }
$defaultname = lc($name);
if ($name ne "!!default") { $defaultname =~ s/\W//g; }
$filename = "$basedir/$defaultdir/$defaultname.txt";
open(DEFAULT,">$filename") || &tech_error("Can't create $filename!");
print DEFAULT "Name: $name\n";
print DEFAULT "Password: $password\n";
if ($email) { print DEFAULT "E-Mail: $email\n"; }
if ($fontface) { print DEFAULT "Font Face: $fontface\n"; }
if ($fontcolor) { print DEFAULT "Font Color: $fontcolor\n"; }
if ($fontsize) { print DEFAULT "Font Size: $fontsize\n"; }
if ($bgtype) { print DEFAULT "Background: $bgtype\n"; }
if ($timezone) { print DEFAULT "Time Zone: $timezone\n"; }
if ($datemode) { print DEFAULT "Date Mode: $datemode\n"; }
if ($cookieexpire) { print DEFAULT "Cookie Expire: $cookieexpire\n"; }
if ($collapse_threads) { print DEFAULT "Collapse Threads: $collapse_threads\n"; }
if ($message_threads) { print DEFAULT "Message Threads: $message_threads\n"; }
if ($header_style) { print DEFAULT "Header Style: $header_style\n"; }
if ($submit_state) { print DEFAULT "Submit State: $submit_state\n"; }
if ($screensize) { print DEFAULT "Screen Size: $screensize\n"; }
if ($view_deleted) { print DEFAULT "View Deleted: $view_deleted\n"; }
if ($view_sigs) { print DEFAULT "View Sigs: $view_sigs\n"; }
if ($auto_save) { print DEFAULT "Auto-Save: $auto_save\n"; }
if ($use_moderate && $msg_threshold) { print DEFAULT "Message Threshold: $msg_threshold\n"; }
if (@ignore_name) {
print DEFAULT "Ignore List: ";
for ($s = 0; $s < @ignore_name; $s++) {
print DEFAULT $ignore_name[$s];
if ($ignore_forum[$s]) { print DEFAULT " <$ignore_forum[$s]>"; }
unless ($s == @ignore_name - 1) { print DEFAULT "\xff"; }
}
print DEFAULT "\n";
}
if ($footerbody) { $r = $footerbody; $r =~ s/\n/\\n/g; print DEFAULT "Footer: $r\n"; }
if ($realname) { print DEFAULT "Real Name: $realname\n"; }
if ($sex) { print DEFAULT "Sex: $sex\n"; }
if ($date_of_birth) { print DEFAULT "Date of Birth: $date_of_birth\n"; }
if ($current_residence) { print DEFAULT "Current Residence: $current_residence\n"; }
if ($occupation) { print DEFAULT "Occupation: $occupation\n"; }
if ($homepage) { print DEFAULT "Home Page: $homepage\n"; }
if ($interests) { print DEFAULT "Interests: $interests\n"; }
for ($r = 1; $r < @custom_entry_description; $r++) {
if ($custom_entry[$r]) { print DEFAULT "Custom Entry #$r: $custom_entry[$r]\n"; }
}
if ($portrait) { print DEFAULT "Portrait: $portrait\n"; }
if ($description) { print DEFAULT "Description: $description\n"; }
if ($first_post_date) { print DEFAULT "First Post Date: $first_post_date\n"; }
else { print DEFAULT "First Post Date: $gmt_epoch\n"; }
if ($last_post_subject) {
print DEFAULT "Last Post Subject: $last_post_subject\n";
print DEFAULT "Last Post Info: $last_post_msg/$last_post_forum/$last_post_date\n";
}
if ($use_moderate && %moderated) {
undef $u;
foreach $r (sort keys %moderated) {
($s,$t) = split(/\;/, $r);
$u .= "$s;".&dec2hex($moderated{$r}).&dec2hex($t)."\xff";
}
chop($u);
print DEFAULT "Moderated Messages: $u\n"
}
print DEFAULT "\xff\xff\xff\n";
$r = 0;
foreach $s (sort { $stats_ip{$b} <=> $stats_ip{$a} } keys %stats_ip) {
print DEFAULT "$s = $stats_ip{$s}\n";
$r++;
if ($r == 10) { last; }
}
for (; $r <= 10; $r++) {
print DEFAULT "\xff\n";
}
$r = 0;
foreach $s (sort { $stats_browser{$b} <=> $stats_browser{$a} } keys %stats_browser) {
print DEFAULT "$s = $stats_browser{$s}\n";
$r++;
if ($r == 10) { last; }
}
for (; $r <= 10; $r++) {
print DEFAULT "\xff\n";
}
foreach $s (sort keys %indexfile) {
print DEFAULT "$s: $stats_msgs{$s}/$stats_ntmsgs{$s}/$stats_words{$s}\n";
}
print DEFAULT "\xff\xff\xff\n";
close(DEFAULT);
chmod $chmod_num, $filename;
}
sub get_master_default {
if ($name eq "!!default") { return; }
open(DEFAULT,"$basedir/$defaultdir/!!default.txt") || &tech_error("Can't read $basedir/$defaultdir/!!default.txt!");
@default = ;
close(DEFAULT);
unless ($msgwidth) { $msgwidth = $basemsgwidth; }
for ($r = 0; $r < @default; $r++) {
if ($default[$r] =~ /^Password: (.*)\n/) { $masterpassword = $1; next; }
if ($default[$r] =~ /^Font Face: (.*)\n/) { $masterfontface = $1; next; }
if ($default[$r] =~ /^Font Size: (.*)\n/) { $masterfontsize = $1; next; }
if ($default[$r] =~ /^Time Zone: (.*)\n/ && !($timezone)) { $timezone = $1; next; }
if ($default[$r] =~ /^Date Mode: (\d{5})\n/ && !($datemode)) { $datemode = $1; next; }
if ($default[$r] =~ /^Cookie Expire: (.*)\n/ && !($cookieexpire)) { $cookieexpire = $1; next; }
if ($default[$r] =~ /^Collapse Threads: (.*)\n/ && !($collapse_threads)) { $collapse_threads = $1; next; }
if ($default[$r] =~ /^Message Threads: (.*)\n/ && !($message_threads)) { $message_threads = $1; next; }
if ($default[$r] =~ /^Header Style: (.*)\n/ && !($header_style)) { $header_style = $1; next; }
if ($default[$r] =~ /^Submit State: (.*)\n/ && !($submit_state)) { $submit_state = $1; next; }
}
unless ($fontface) { $r = $masterfontface; } else { $r = "$fontface, $masterfontface"; }
unless ($fontsize) { $fontsize = $masterfontsize; }
if ($fontcolor) {
$mesgfont = "";
}
else {
$mesgfont = "";
}
}
sub validate_password {
if (length(crypt("password", "12")) == 28) { $cryptoffset = 3; } # FreeBSD crypt method
elsif (length(crypt("password", "12")) == 13) { $cryptoffset = 0; } # Every other OS's crypt method
else { &tech_error("Illegal crypt method! (crypt(\"password\", \"12\") = ".crypt("password", "12").")"); }
if ($COOKIE{'GodPassword'} && crypt($COOKIE{'GodPassword'}, substr($godpassword, $cryptoffset, 2)) eq $godpassword) {
$FORM{'password'} = $COOKIE{'GodPassword'};
return 3;
}
if ($FORM{'password'} && crypt($FORM{'password'}, substr($godpassword, $cryptoffset, 2)) eq $godpassword) { return 3; }
if ($COOKIE{'MasterPassword'} && crypt($COOKIE{'MasterPassword'}, substr($masterpassword, $cryptoffset, 2)) eq $masterpassword) {
$FORM{'password'} = $COOKIE{'MasterPassword'};
return 2;
}
if ($FORM{'password'} && crypt($FORM{'password'}, substr($masterpassword, $cryptoffset, 2)) eq $masterpassword) { return 2; }
if ($COOKIE{'Password'} && crypt($COOKIE{'Password'}, substr($password, $cryptoffset, 2)) eq $password) {
$FORM{'password'} = $COOKIE{'Password'};
return 1;
}
if ($FORM{'password'} && crypt($FORM{'password'}, substr($password, $cryptoffset, 2)) eq $password) { return 1; }
else { return 0; }
}
sub request_password {
print "Content-type: text/html; charset=$charset\n\n";
print "\n";
print "
\n";
print " \n";
print " \n";
print " Need Password \n";
print "\n";
if ($standardbg) {
print "
\n";
}
elsif ($bgcolor) {
print "
\n";
}
else {
print "
\n";
}
print "$header\n";
print "(NOTE: You must have your cookies turned on.)
\n";
unless ($ENV{'QUERY_STRING'}) { print "
\n"; }
else { print "
\n"; }
print "Password: \n";
print " \n";
&print_credits;
exit;
}
sub print_cookies {
unless ($cookieexpire) { $cookieexpire = 31536000; }
$j = &convert_date($gmt_epoch + $cookieexpire, " 0000", -1);
if ($ENV{'SCRIPT_NAME'} eq $rpgboard_uri) { print "Set-cookie: Name=$name ; expires=$j ; path=/\n"; }
if (&validate_password == 3) { print "Set-cookie: GodPassword=$FORM{'password'} ; expires=$j ; path=/\n"; }
elsif (&validate_password == 2) { print "Set-cookie: MasterPassword=$FORM{'password'} ; expires=$j ; path=/\n"; }
elsif (&validate_password == 1) { print "Set-cookie: Password=$FORM{'password'} ; expires=$j ; path=/\n"; }
if ($ENV{'SCRIPT_NAME'} eq $rpgboard_uri && ($FORM{'action'} eq "post" || $FORM{'msgtags'} eq "N")) {
print "Set-cookie: NoUpdate=yes ; expires=".&convert_date($gmt_epoch + 900, " 0000", -1)." ; path=/\n";
unless ($COOKIE{'NoUpdate'}) {
$j = &convert_date($gmt_epoch + 31536000, " 0000", -1);
print "Set-cookie: CurrentPostDate=$COOKIE{'CurrentPostDate'} ; expires=$j ; path=/\n";
print "Set-cookie: LastPostDate=$COOKIE{'LastPostDate'} ; expires=$j ; path=/\n";
}
}
}
sub print_transparent {
print "Content-type: image/gif\n\n";
print "GIF89a\cA\c@\cA\c@\x80\c@\c@\c@\c@\c@\xff\xff\xff!\xf9\cD\cA\c@\c@\c@\c@,\c@\c@\c@\c@\cA\c@\cA\c@\c@\cB\cAD\c@;";
exit;
}
sub print_credits {
print "$footer\n\n";
print "".$title{'Default'}."'s RPGBoard script (V$version) was created by\n";
print "Brendan Byrd/SineSwiper of Resonator Software . \n";
print "It is copylefted under the conditions of the GNU \n";
print "Public License (GPL ). It can be freely distributed and modified as long as it retains\n";
print "its GPL status.
\n\n";
print "$counter\n\n";
print "\n";
print "
\n";
exit;
}
$version = "2.10a";
##############################################################################
# RPGBoard Headers shared code version 2.10a #
# Copyleft 1999 Brendan Byrd and Resonator Software #
# Contact me at: sineswiper@resonatorsoft.com #
##############################################################################
sub display_headers {
if ($ENV{'SCRIPT_NAME'} eq $rpgmessage_uri) {
if ($message_threads eq "N" || $special_option eq "C") {
$headerrootnum = $HEADER{"MessageID"};
$headerrootdate = $HEADER{"Date"};
}
else {
$headerrootnum = $HEADER{"Root MessageID"};
$headerrootdate = $HEADER{"Root Date"};
}
}
elsif ($querynum) {
$headerrootnum = $querynum;
$headerrootdate = $querydate;
}
if ($previewframe) { $previewframetag = " target=\"$previewframe\""; }
if ($header_style == 3) {
if ($use_backgrounds && $ENV{'SCRIPT_NAME'} eq $rpgmessage_uri) {
$normalfontstart = "";
$normalfontend = " \n";
}
print "$headertable\n";
print "
\n";
print " $rpgheadersfont$normalfontstartSubject $normalfontend\n";
print " $rpgheadersfont$normalfontstartName $normalfontend\n";
print " $rpgheadersfont$normalfontstartDate $normalfontend\n";
print " $rpgheadersfont$normalfontstartReplies $normalfontend\n";
print " \n";
}
else {
if ($use_backgrounds && $ENV{'SCRIPT_NAME'} eq $rpgmessage_uri) { print ""; }
print "$rpgheadersfont\n\n";
print "\n";
}
unless ($headerrootdate) {
opendir(INDEXLIST,"$basedir/$mesgdir") || &tech_error("Can't open listing for $basedir/$mesgdir while displaying headers!");
@indexlist = reverse sort grep { /\.index(?:\.gz|\.bz2)?$/ } readdir(INDEXLIST);
closedir(INDEXLIST);
}
else {
@indexlist = (&convert_date($headerrootdate, " 0000", 0).".index");
$notroot = "yes";
}
foreach $indexfile (@indexlist) {
if ($indexfile =~ /(\d*)\.index/) {
$filedate = $1;
if (length($filedate) == 4) { $filedate = $filedate."9999"; }
elsif (length($filedate) == 6) { $filedate = $filedate."99"; }
else { $filedate = $filedate; }
open(INDEXFILE,&read_datefile("$filedate.index")) || &tech_error("Can't read $filedate.index while displaying headers! (Read method: ".&read_datefile("$filedate.index").")");
@headers = ;
close(INDEXFILE);
for ($j = 0; $j < @headers; $j++) {
if ($headers[$j] =~ /^([\ ]*)(\d+)\xff(.+)\xff(.?)\xff(.*)\xff(.+)\xff(\d+)(D|M[-\+]+\d+)?$/) {
$spaces = $1; $headerdate = $2; $headersubject = $3; $headertag = $4;
$headersection = $5; $headername = $6; $headernum = $7; $headeroption = $8;
if ($headeroption =~ /^M(.+)/) { $headerscore = $msg_points + int($1); }
else { $headerscore = $msg_points; }
if ($expire_time == -1) {
$headerbytes += length($headersubject) + length($headersection) + length($headername);
if (length($spaces) == 0 && $headerbytes > 6000) {
for ($r = 0; $r < @labels; $r++) {
if ((($gmt_epoch - $headerdate) / 3600) < $expirevalues[$r]) { $expire_time = $expirevalues[$r]; last; }
}
}
}
undef $num_directreplies; undef $num_replies;
for ($k = $j + 1; $k < @headers; $k++) {
if ($headers[$k] =~ /^([\ ]*)\d+\xff.+\xff.?\xff.*\xff.+\xff\d+(D|M[-\+]+\d+)?$/) {
if (length($1) <= length($spaces)) { last; }
elsif (length($1) == length($spaces) + 2 && $2 ne "D") { $num_directreplies++; }
if ($2 ne "D") { $num_replies++; }
}
}
$num_directreplies = int($num_directreplies);
$num_replies = int($num_replies);
unless ($headerrootdate) {
if ($collapse_threads eq "Y" && length($spaces)) { next; }
if (length($spaces) == 0 && $expire_time != -1 && ($gmt_epoch - $expire_time * 3600) > $headerdate) {
&finish_headers;
return;
}
if ($ignore && (length($spaces) <= length($ignorespaces))) { undef $ignore; }
unless ($ignore) {
unless ($headeroption ne "D" || (($view_deleted eq "Y" && ($headername eq $name || (&validate_password >= 2))) || $ENV{'SCRIPT_NAME'} eq $rpgadmin_uri)) { $ignore = "yes"; $ignorespaces = $spaces; }
for ($r = 0; $r < @ignore_name; $r++) { if ($headername eq $ignore_name[$r] && ($forum eq $ignore_forum[$r] || !$ignore_forum[$r])) { $ignore = "yes"; $ignorespaces = $spaces; } }
if ($headerscore < int($msg_threshold)) { $ignore = "yes"; $ignorespaces = $spaces; }
}
unless ($ignore) { &print_header; }
}
else {
if (!($notroot) && (length($spaces) <= length($rootspaces))) {
&finish_headers;
return;
}
if ($ignore && (length($spaces) <= length($ignorespaces))) { undef $ignore; }
unless ($ignore) {
unless ($headeroption ne "D" || (($view_deleted eq "Y" && ($headername eq $name || (&validate_password >= 2))) || $ENV{'SCRIPT_NAME'} eq $rpgadmin_uri)) { $ignore = "yes"; $ignorespaces = $spaces; }
for ($r = 0; $r < @ignore_name; $r++) { if ($headername eq $ignore_name[$r] && ($forum eq $ignore_forum[$r] || !$ignore_forum[$r])) { $ignore = "yes"; $ignorespaces = $spaces; } }
if ($headerscore < int($msg_threshold)) { $ignore = "yes"; $ignorespaces = $spaces; }
}
if ($headernum == $headerrootnum) { undef $notroot; $rootspaces = $spaces; }
unless ($ignore || $notroot) {
$spaces = substr($spaces, length($rootspaces));
&print_header;
}
}
}
}
}
}
if ($expire_time == -1) { $expire_time = 100000; }
&finish_headers;
}
sub print_header {
if ($headeroption eq "D") {
$deletedstrike = "";
$deletedend = " ";
}
else {
undef $deletedstrike;
undef $deletedend;
}
if ($ENV{'SCRIPT_NAME'} eq $rpgadmin_uri && !($FORM{'action'})) {
unless ($spaces) { $adminrootdate = $headerdate; }
$checkbox = " ";
}
if ($special_option eq "C") {
$linkheader = "#";
}
else {
$linkheader = "$rpgmessage_uri?$forum;";
}
if ($use_backgrounds && $ENV{'SCRIPT_NAME'} eq $rpgmessage_uri) {
$fontlink = "";
$fontend = " ";
}
if ($ENV{'SCRIPT_NAME'} eq $rpgmessage_uri && $headernum == $HEADER{"MessageID"} && $special_option ne "C") {
undef $linkstart;
undef $linkend;
}
else {
$linkstart = "$fontlink";
$linkend = "$fontend ";
}
if ($headertag) {
if ($headersection) {
if ($header_style < 2) { $tag = " ($msgtag{$headertag} - $headersection) "; }
else { $tag = " ($msgtag{$headertag} - $headersection) "; }
}
else {
if ($header_style < 2) { $tag = " ($msgtag{$headertag}) "; }
else { $tag = " ($msgtag{$headertag}) "; }
}
}
else {
undef $tag;
}
if ($headerdate > $COOKIE{'CurrentPostDate'}) {
$fontdatecolor = "";
$fontdateend = " ";
$newerposts++;
}
elsif ($headerdate > $COOKIE{'LastPostDate'}) {
$fontdatecolor = "";
$fontdateend = " ";
$newposts++;
}
else {
undef $fontdatecolor;
undef $fontdateend;
$oldposts++;
}
$defaultname = lc($headername);
$defaultname =~ s/\W//g;
unless ($FORM{'action'} eq "remove" || $FORM{'action'} eq "search") {
if ($header_style == 3) {
if (length($spaces)) {
$indentimg = " ";
}
else { undef $indentimg; }
}
else {
while(1) {
if (length($spaces) > length($lastspaces)) {
print " $lastspaces\n";
$lastspaces = $lastspaces." ";
}
elsif (length($spaces) < length($lastspaces)) {
$lastspaces = substr($lastspaces, 2);
print " $lastspaces \n";
}
else { last; }
};
}
if (!$headerrootdate && ($header_style == 5 || $header_style < 2) && !$spaces) { print " $forumline\n"; }
if ($headerscore == $msg_points) { $listtag = ""; }
elsif ($headerscore < $msg_points) { $listtag = " "; }
elsif ($headerscore > $msg_points) { $listtag = " "; }
}
else {
$listtag = " ";
}
if ($header_style < 2) { print " $spaces$listtag$checkbox$deletedstrike$linkstart$headersubject$linkend$tag <$fontlink$headername$fontend > \[$fontdatecolor".&convert_date($headerdate, $timezone, $datemode."1")."$fontdateend \] ($num_directreplies/$num_replies) $deletedend \n"; }
elsif ($header_style == 2) {
print " $spaces$listtag$checkbox$deletedstrike$linkstart$headersubject$linkend$tag (replies: $num_directreplies/$num_replies) \n";
print " $spaces$fontlink$headername$fontend -- $fontdatecolor".&convert_date($headerdate, $timezone, $datemode."1")."$fontdateend$deletedend\n";
}
elsif ($header_style == 3) {
print " \n";
print " $rpgheadersfont$normalfontstart$indentimg • $checkbox$deletedstrike$linkstart$headersubject$linkend$tag$deletedend$normalfontend \n";
print " $rpgheadersfont$deletedstrike$fontlink$headername$fontend $deletedend \n";
print " $rpgheadersfont$normalfontstart$deletedstrike$fontdatecolor".&convert_date($headerdate, $timezone, $datemode."1")."$fontdateend$deletedend$normalfontend \n";
print " $rpgheadersfont$normalfontstart$deletedstrike$num_directreplies/$num_replies$deletedend$normalfontend \n";
print " \n";
}
elsif ($header_style == 4) { print " $spaces$listtag$checkbox$deletedstrike$linkstart$headersubject$linkend$tag - $fontlink$headername$fontend $fontdatecolor".&convert_date($headerdate, $timezone, $datemode."1")."$fontdateend ($num_directreplies/$num_replies)$deletedend\n"; }
elsif ($header_style == 5) { print " $spaces$listtag$checkbox$deletedstrike$linkstart$headersubject$linkend$tag \ $fontlink$headername$fontend , $fontdatecolor".&convert_date($headerdate, $timezone, $datemode."1")."$fontdateend ($num_directreplies/$num_replies) $deletedend\n"; }
}
sub finish_headers {
if ($header_style == 3) { print "\n"; }
else {
while(1) {
if (length($lastspaces) != 0) {
$lastspaces = substr($lastspaces, 2);
print " $lastspaces \n";
}
else { last; }
}
if (!$headerrootdate && ($header_style == 5 || $header_style < 2)) { print " $forumline\n"; }
print "\n\n";
print " \n";
}
}
$temp = "!";
#!/usr/bin/perl
##############################################################################
# RPGBoard Message Viewer version 2.10a #
# Copyleft 1999 Brendan Byrd and Resonator Software #
# Contact me at: sineswiper@resonatorsoft.com #
##############################################################################
$SIG{__DIE__} = \&tech_error;
sub tech_error {
print "Content-type: text/plain; charset=$charset\n\n";
print "ERROR: $_[0]";
exit;
}
for $j ("rpgvariables.h", "rpgglobal.h", "rpgheaders.h", "rpgmessage.h") {
unless ($k = do $j) {
&tech_error("Couldn't parse $j: $@") if $@;
&tech_error("Couldn't do $j: $!") unless defined $k;
}
}
if ($COOKIE{'Name'}) { $name = $COOKIE{'Name'}; }
&calc_expire_time;
&get_default;
&get_master_default;
&read_message;
unless ($special_option eq "C") { &view_message; } else { &collate_thread; }
sub view_message {
print "Expires: ".&convert_date($gmt_epoch + 900, " 0000", -1)."\n";
print "Cache-Control: max-age=900\n";
print "Last-Modified: ".&convert_date($HEADER{"Date"}, " 0000", -1)."\n";
print "Content-type: text/html; charset=$charset\n\n";
print "\n";
print "
\n";
print " \n";
print " \n";
print " ".$HEADER{"Subject"}." \n";
print "\n";
if ($use_backgrounds) {
print "
\n";
}
elsif ($standardbg) {
print "
\n";
}
else {
print "
\n";
}
print "$header\n";
print "$title ";
unless ($option == 1) {
if ($message_threads eq "Y") {
print " - Message Thread ";
}
else {
print " - Replies ";
}
print " - Post a Reply ";
print " - Collate Replies ";
}
print " - FAQ
\n";
if ($correctoffset) { print "(WARNING: The message offset for this message ($msgoffset bytes) is bad. The correct offset is $correctoffset bytes. This has been fixed.) \n"; }
unless ($deleted) {
if ($use_moderate && ($HEADER{"Root Date"} + $expire_time * 3600) > $gmt_epoch) {
print "\n";
&message_table;
print " \n";
}
else { &message_table; }
print "\n";
if (($name eq $HEADER{"Name"} && &validate_password) || &validate_password >= 2) {
print " \n";
}
else {
print "Password to delete message: \n";
}
print " \n";
}
else {
print "(NOTE: This message is marked for deletion.) \n";
&message_table;
print "\n";
if (&validate_password >= 2) {
print " \n";
}
else {
print "Password to undelete message: \n";
}
print " \n";
}
unless ($option == 1) {
if ($use_backgrounds) { print "$table\n"; }
else { print "$forumline
\n"; }
if ($message_threads eq "Y") { print "$headerfontMessage Thread:
\n"; }
else { print "$headerfontReplies: \n"; }
&display_headers;
if ($use_backgrounds) { print " \n"; }
else { print "$forumline
\n"; }
if (($HEADER{"Root Date"} + $expire_time * 3600) > $gmt_epoch && !$deleted) {
print "$headerfontPost a Reply
\n";
print "\n";
&rest_of_form;
}
else {
&print_credits;
}
}
else {
&print_credits;
}
}
sub collate_thread {
print "Content-type: text/html; charset=$charset\n\n";
print "\n";
print "
\n";
print " \n";
print " \n";
print " Collation of \"".$HEADER{"Subject"}."\" \n";
print "\n";
if ($standardbg) {
print "
\n";
}
else {
print "
\n";
}
print "$header\n";
print "$title - FAQ
\n";
&display_headers;
$notroot = "yes";
open(INDEXFILE,&read_datefile(&lock_datefile(&convert_date($HEADER{"Date"}, " 0000", 0).".index"))) || &tech_error("Can't read ".&convert_date($HEADER{"Date"}, " 0000", 0).".index while collating threads! (Read method: ".&read_datefile(&convert_date($HEADER{"Date"}, " 0000", 0).".index").")");
@headers = ;
close(INDEXFILE);
&unlock_datefile(&convert_date($HEADER{"Date"}, " 0000", 0).".index");
foreach $headerline (@headers) {
if ($headerline =~ /([\ ]*)(\d*)\xff.*\xff.*\xff.*\xff(.*)\xff(\d*)(D|M[-\+]+\d+)?/) {
$spaces = $1; $headerdate = $2; $headername = $3; $headernum = $4; $headeroption = $5;
if (!($notroot) && (length($spaces) <= length($rootspaces))) { last; }
if ($ignore && (length($spaces) <= length($lastspaces))) { undef $ignore; }
for ($r = 0; $r < @ignore_name; $r++) { if ($headername eq $ignore_name[$r] && ($forum eq $ignore_forum[$r] || !$ignore_forum[$r])) { $ignore = "yes"; } }
if ($headernum == $headerrootnum) { undef $notroot; $rootspaces = $spaces; }
unless ($ignore || $notroot) {
if ($headeroption eq "D" && !($view_deleted || ($headername eq $name))) { next; }
$lastspaces = $spaces; $querynum = $headernum; $querydate = $headerdate;
&read_message;
if ($use_backgrounds) {
$j = $linkcolor[$HEADER{"Background"}];
$body =~ s/(.*)<\/a>/ $2<\/font><\/a>/gi;
}
print "$forumline
\n";
print "View Message - Back to Top
\n";
if ($deleted) {
print " (NOTE: This message is marked for deletion.) \n";
&message_table;
}
elsif ($use_moderate && ($headerdate + $expire_time * 3600) > $gmt_epoch) {
print "\n";
&message_table;
print " \n";
}
}
}
}
&print_credits;
}
##############################################################################
# RPGBoard Messages shared code version 2.10a #
# Copyleft 1999 Brendan Byrd and Resonator Software #
# Contact me at: sineswiper@resonatorsoft.com #
##############################################################################
sub read_message {
open(LOCFILE,&read_datefile(&lock_datefile(&convert_date($querydate, " 0000", 0).".loc"))) || &tech_error("Can't read ".&convert_date($querydate, " 0000", 0).".loc while reading a message! (Read method: ".&read_datefile(&convert_date($querydate, " 0000", 0).".loc").")");
read(LOCFILE, $num, 4, 0);
$num = unpack("L", $num);
$s = read(LOCFILE, $r, ($querynum - $num) * 4);
if ($s != ($querynum - $num) * 4) {
&unlock_datefile(&convert_date($querydate, " 0000", 0).".loc");
&tech_error("End of file reached in location file before finding message offset!");
}
undef $r;
read(LOCFILE, $msgoffset, 4, 0);
$msgoffset = unpack("L", $msgoffset);
close(LOCFILE);
&unlock_datefile(&convert_date($querydate, " 0000", 0).".loc");
if ($msgoffset == (2 ** 32 - 1)) { &error(msg_purged); }
elsif ($msgoffset >= (2 ** 31)) {
$deleted = "yes";
$msgoffset -= (2 ** 31);
}
else { undef $deleted; }
open(MSGFILE,&read_datefile(&lock_datefile(&convert_date($querydate, " 0000", 0).".msg"))) || &tech_error("Can't read ".&convert_date($querydate, " 0000", 0).".msg while reading a message! (Read method: ".&read_datefile(&convert_date($querydate, " 0000", 0).".msg").")");
read(MSGFILE, $r, $msgoffset);
undef %HEADER; undef $body; undef $spoilbody; undef $correctoffset;
$HEADER{"MessageID"} = $querynum;
$msgline = ;
unless ($msgline =~ /MessageID: $querynum/) {
# Auto-correction code for bad message offsets
close(MSGFILE);
open(MSGFILE,&read_datefile(&convert_date($querydate, " 0000", 0).".msg")) || &tech_error("Can't read ".&convert_date($querydate, " 0000", 0).".msg while reading a message! (Read method: ".&read_datefile(&convert_date($querydate, " 0000", 0).".msg").")");
while(1) {
$msgline = ;
if ($msgline =~ /^MessageID: $querynum\n/) { last; }
unless (defined $msgline) {
&unlock_datefile(&convert_date($querydate, " 0000", 0).".msg");
&tech_error("Message offset is bad and can't find MessageID ($querynum)! ".&convert_date($querydate, " 0000", 0).".loc may be corrupt!");
}
$correctoffset += length($msgline);
};
open(LOCFILE,&read_datefile(&lock_datefile(&convert_date($querydate, " 0000", 0).".loc"))) || &tech_error("Can't read ".&convert_date($querydate, " 0000", 0).".loc while correcting message offset! (Read method: ".&read_datefile(&convert_date($querydate, " 0000", 0).".loc").")");
$loc = join('', );
close(LOCFILE);
$num = unpack("L", substr($loc, 0, 4));
$newloc = substr($loc, 0, ($querynum - $num + 1) * 4).pack("L", $correctoffset).substr($loc, ($querynum - $num + 2) * 4);
open(LOCFILE,&write_datefile(&convert_date($querydate, " 0000", 0).".loc")) || &tech_error("Can't write ".&convert_date($querydate, " 0000", 0).".loc while correcting message offset! (Write method: ".&read_datefile(&convert_date($querydate, " 0000", 0).".loc").")");
print LOCFILE $newloc;
close(LOCFILE);
&unlock_datefile(&convert_date($querydate, " 0000", 0).".loc");
}
while(1) {
$msgline = ;
if ($msgline =~ /(.*?): (.*)\n/) { $HEADER{$1} = $2; next; }
if ($msgline =~ /\xff\n/) { last; }
};
while(1) {
$msgline = ;
unless ($msgline =~ /\xff\n/) { $body = $body.$msgline; }
else { last; }
};
if ($body =~ /\n$/) { chop($body); }
while(1) {
$msgline = ;
unless ($msgline =~ /\xff\xff\xff\n/) { $spoilbody = $spoilbody.$msgline; }
else { last; }
};
if ($spoilbody =~ /\n$/) { chop($spoilbody); }
close(MSGFILE);
&unlock_datefile(&convert_date($querydate, " 0000", 0).".msg");
if ($use_moderate && $ENV{'SCRIPT_NAME'} eq $rpgmessage_uri) {
open(INDEXFILE,&read_datefile(&convert_date($HEADER{"Root Date"}, " 0000", 0).".index")) || &tech_error("Can't read ".&convert_date($HEADER{"Root Date"}, " 0000", 0).".index while reading a message! (Read method: ".&read_datefile(&convert_date($HEADER{"Root Date"}, " 0000", 0).".index").")");
while(1) {
$indexline = ;
if ($indexline =~ /^[\ ]*\d+\xff.+\xff.?\xff.*\xff.+\xff$querynum(D|M[-\+]+\d+)?$/) {
$indexoption = $1;
if ($indexoption =~ /^M\+(\d+)$/) { $HEADER{"Score"} = $msg_points + $1; }
elsif ($indexoption =~ /^M\-(\d+)$/) { $HEADER{"Score"} = $msg_points - $1; }
else { $HEADER{"Score"} = $msg_points; }
last;
}
};
close(INDEXFILE);
}
}
sub message_table {
if ($use_backgrounds) {
$r = $bgcolor[$HEADER{"Background"}];
$s = "";
$t = "";
$u = " ";
}
else {
$r = $bgcolor;
undef $s; undef $t; undef $u;
}
$defaultname = lc($HEADER{"Name"});
$defaultname =~ s/\W//g;
print "$table\n";
print "
\n";
print " $s$titlefontNick: $u \n";
print " $t".$HEADER{"Name"}."$u \n";
print " \n";
print " \n";
print " $s$titlefontDate/Time: $u \n";
unless ($timezone eq $HEADER{"Time Zone"}) { print " $s".&convert_date($HEADER{"Date"}, $timezone, $datemode."0")." (".&convert_date($HEADER{"Date"}, $HEADER{"Time Zone"}, $datemode."0").")$u \n"; }
else { print " $s".&convert_date($HEADER{"Date"}, $timezone, $datemode."0")."$u \n"; }
print " \n";
if (($use_ip_display || &validate_password >= 2) && $HEADER{"IP Address"}) {
print " \n";
print " $s$titlefontIP Address: $u \n";
if ($HEADER{"Proxy Destination"}) {
print " $s".$HEADER{"Proxy Destination"}." via proxy ".$HEADER{"IP Address"}." (".$HEADER{"IP Name"}.")$u \n";
}
else {
print " $s".$HEADER{"IP Address"}." (".$HEADER{"IP Name"}.")$u \n";
}
print " \n";
}
if ($HEADER{'HTTP_USER_AGENT'}) {
print " \n";
print " $s$titlefontBrowser: $u \n";
print " $s".&get_browser_info($HEADER{'HTTP_USER_AGENT'})." $u \n";
print " \n";
}
if ($use_moderate && !$deleted && ($HEADER{"Root Date"} + $expire_time * 3600) > $gmt_epoch && $FORM{'action'} ne "spellcheck" && $FORM{'action'} ne "preview") {
print " \n";
print " $s$titlefontScore: $u \n";
if (&validate_password >= 2) {
print " $s\n";
for ($x = $msg_points * 2; $x >= -$msg_points; $x--) {
if ($HEADER{"Score"} == $x) { print " $x\n"; }
else { print " $x\n"; }
}
print " $u \n";
}
elsif ($stats_msgs{$forum} >= $min_msgs && &validate_password == 1 && !$moderated{"$forum;$querynum"} && $name ne $HEADER{"Name"}) {
print " $s\n";
if ($HEADER{"Score"} < $msg_points * 2) { print " ".int($HEADER{"Score"} + 1)."\n"; }
print " ".int($HEADER{"Score"})."\n";
if ($HEADER{"Score"} > -$msg_points) { print " ".int($HEADER{"Score"} - 1)."\n"; }
print " $u \n";
}
else { print " $s".int($HEADER{"Score"})."$u \n"; }
print " \n";
}
unless ($HEADER{"Tag"} eq "N") {
print " \n";
print " $s$titlefontSubject: $u \n";
print " $s".$HEADER{"Subject"}."$u \n";
print " \n";
if ($HEADER{"Tag"}) {
print " \n";
print " $s$titlefontSpoiler Tag: $u \n";
if ($HEADER{"Spoiler Text"}) {
print " $s".$msgtag{$HEADER{"Tag"}}." - ".$HEADER{"Spoiler Text"}."$u \n";
}
else {
print " $s".$msgtag{$HEADER{"Tag"}}."$u \n";
}
print " \n";
}
}
print " \n";
print " $s$titlefontMessage: $u \n";
print " \n";
print " \n";
print " ";
if ($HEADER{"Image"}) { print "
\n"; }
if ($HEADER{"Footer"} && $view_sigs ne "N") { print "$s$body\n\n".$HEADER{"Footer"}."$u\n"; }
else { print "$s$body$u\n"; }
print "
\n";
print " \n";
if ($spoilbody && $HEADER{"Tag"} ne "N") {
print " \n";
print " $s$titlefontSpoiler Message: $u \n";
print " \n";
print " \n";
print " $s$spoilbody$u \n";
print " \n";
}
if ($HEADER{"Link URL"}) {
print " \n";
print " $s$titlefontLink: $u \n";
print " $t".$HEADER{"Link Title"}."$u \n";
print " \n";
}
print "\n";
}
sub rest_of_form {
unless ($msgwidth) { &get_default; }
$FORM{'body'} =~ s/&/&/g;
$FORM{'body'} =~ s/"/"/g;
$FORM{'body'} =~ s/</g;
$FORM{'body'} =~ s/>/>/g;
$FORM{'spoilbody'} =~ s/&/&/g;
$FORM{'spoilbody'} =~ s/"/"/g;
$FORM{'spoilbody'} =~ s/</g;
$FORM{'spoilbody'} =~ s/>/>/g;
if ($HEADER{"Root Date"}) {
print " \n";
print " \n";
}
if ($HEADER{"Mail to"}) {
print " \n";
}
print "\n";
print "Message: \n";
if ($querydate) {
print "\n";
}
else {
print "\n";
}
if ($use_spoilermsg) {
print "Hidden Spoiler Message: \n";
print "$FORM{'spoilbody'} ";
}
if ($use_html) {
print " \nConvert to HTML \n\n";
}
else { print "
\n"; }
print "
\n";
print "\n";
if ($use_spellcheck) {
if ($submit_state eq "spellcheck") { print " Preview & SpellCheck\n"; }
else { print " Preview & SpellCheck\n"; }
if ($submit_state eq "preview") { print " Preview w/o SpellCheck\n"; }
else { print " Preview w/o SpellCheck\n"; }
}
else {
if ($submit_state eq "preview") { print " Preview Message\n"; }
else { print " Preview Message\n"; }
}
if ($submit_state eq "post") { print " Post Message\n"; }
else { print " Post Message\n"; }
print " <<< \n";
print "
\n";
print "Tired of setting your standard options? Go to the defaults page and customize your options! \n";
&print_credits;
}
$temp = "!";
#!/usr/bin/perl
##############################################################################
# RPGBoard Search Engine version 2.10a #
# Copyleft 1999 Brendan Byrd and Resonator Software #
# Contact me at: sineswiper@resonatorsoft.com #
##############################################################################
$SIG{__DIE__} = \&tech_error;
sub tech_error {
print "Content-type: text/plain; charset=$charset\n\n";
print "ERROR: $_[0]";
exit;
}
for $j ("rpgvariables.h", "rpgglobal.h", "rpgheaders.h", "rpgmessage.h") {
unless ($k = do $j) {
&tech_error("Couldn't parse $j: $@") if $@;
&tech_error("Couldn't do $j: $!") unless defined $k;
}
}
if ($COOKIE{'Name'}) { $name = $COOKIE{'Name'}; }
&get_default;
&get_master_default;
&get_variables;
&calc_expire_time;
if ($FORM{'action'} eq 'search') { &display_search_results; }
else { &display_search; }
sub get_variables {
if ($FORM{'phrase'}) {
$phrase = $FORM{'phrase'};
}
else { &display_search; }
if ($FORM{'type'}) {
$search_type = $FORM{'type'};
}
else { &display_search; }
if ($FORM{'area'}) {
$search_area = $FORM{'area'};
}
else { &display_search; }
if ($FORM{'forum'}) {
$forum = $FORM{'forum'};
$title = $title{$forum};
$expire_time = $expire_time{$forum};
$indexfile = $indexfile{$forum};
$mesgdir = $mesgdir{$forum};
}
else { &display_search; }
if ($FORM{'expire'}) {
$expire_time = $FORM{'expire'};
}
else { &display_search; }
}
sub display_search {
if ($ENV{'HTTP_REFERER'}) {
foreach $j (keys %indexfile) {
if ($ENV{'HTTP_REFERER'} =~ /\Q$indexfile{$j}\E/) {
$FORM{'forum'} = $j;
$FORM{'expire'} = $expire_time{$j};
}
}
}
$FORM{'area'} = "subject";
print "Content-type: text/html; charset=$charset\n\n";
print "\n";
print "
\n";
print " \n";
print " \n";
print " RPGBoard Search \n";
print "\n";
print "
\n";
print "$header\n";
print "$headerfontRPGBoard Search \n";
print "$forumline \n";
&search_table;
}
sub display_search_results {
$| = 1;
print "Content-type: text/html; charset=$charset\n\n";
print "\n";
print "
\n";
print " \n";
print " \n";
print " RPGBoard Search for \[$phrase\] \n";
print "\n";
print "
\n";
print "$header\n";
print "$headerfontSearching Messages \n";
print "$forumline \n";
if ($header_style == 3) {
print "$headertable\n";
print "
\n";
print " ".$rpgheadersfont."Subject \n";
print " ".$rpgheadersfont."Name \n";
print " ".$rpgheadersfont."Date \n";
print " \n";
}
else {
print "$rpgheadersfont\n\n";
print "";
}
&search_msgs;
if ($header_style == 3) { print "\n"; } else { print " \n\n"; }
print "$forumline
\n";
&search_table;
}
sub search_table {
$FORM{'phrase'} =~ s/\"/\"\;/g;
print "
\n";
print "\n";
print "\n";
&print_credits;
exit;
}
sub search_msgs {
opendir(INDEXLIST,"$basedir/$mesgdir") || &tech_error("Can't open listing for $basedir/$mesgdir while searching headers!");
@indexlist = reverse sort grep { /\.index(?:\.gz|\.bz2)?$/ } readdir(INDEXLIST);
closedir(INDEXLIST);
foreach $indexfile (@indexlist) {
if ($indexfile =~ /(\d*)\.index/) {
$filedate = $1;
if (length($filedate) == 4) { $filedate = $filedate."9999"; }
elsif (length($filedate) == 6) { $filedate = $filedate."99"; }
else { $filedate = $filedate; }
open(INDEXFILE,&read_datefile(&lock_datefile("$filedate.index"))) || &tech_error("Can't read $filedate.index while searching headers! (Read method: ".&read_datefile("$filedate.index").")");
@headers = ;
close(INDEXFILE);
&unlock_datefile("$filedate.index");
for ($j = 0; $j < @headers; $j++) {
if ($headers[$j] =~ /^([\ ]*)(\d+)\xff(.+)\xff(.?)\xff(.*)\xff(.+)\xff(\d+)(D|M[-\+]+\d+)?$/) {
$spaces = $1; $headerdate = $2; $headersubject = $3; $headertag = $4;
$headersection = $5; $headername = $6; $headernum = $7; $headeroption = $8;
undef $num_directreplies; undef $num_replies;
for ($k = $j + 1; $k < @headers; $k++) {
if ($headers[$k] =~ /^([\ ]*)\d+\xff.+\xff.?\xff.*\xff.+\xff\d+(D|M[-\+]+\d+)?$/) {
if (length($1) <= length($spaces)) { last; }
elsif (length($1) == length($spaces) + 2 && $2 ne "D") { $num_directreplies++; }
if ($2 ne "D") { $num_replies++; }
}
}
$num_directreplies = int($num_directreplies);
$num_replies = int($num_replies);
if (length($spaces) == 0 && ($gmt_epoch - $expire_time * 3600) > $headerdate) { return; }
if ($ignore && (length($spaces) <= length($ignorespaces))) { undef $ignore; }
unless ($ignore) {
unless ($headeroption ne "D" || (($view_deleted eq "Y" && ($headername eq $name || (&validate_password >= 2))) || $ENV{'SCRIPT_NAME'} eq $rpgadmin_uri)) { $ignore = "yes"; $ignorespaces = $spaces; }
for ($r = 0; $r < @ignore_name; $r++) { if ($headername eq $ignore_name[$r] && ($forum eq $ignore_forum[$r] || !$ignore_forum[$r])) { $ignore = "yes"; $ignorespaces = $spaces; } }
}
unless ($ignore) {
if ($search_area eq "name" && &find_string($headername)) { &print_header; }
elsif ($search_area eq "subject" && &find_string($headersubject)) { &print_header; }
elsif ($search_area eq "body") {
$querynum = $headernum; $querydate = $headerdate;
&read_message;
if (&find_string($body)) { &print_header; }
}
elsif ($search_area eq "all") {
$querynum = $headernum; $querydate = $headerdate;
&read_message;
if (&find_string("$headername $headersubject $body")) { &print_header; }
}
}
}
}
}
}
}
sub find_string {
$search_query = $_[0];
$search_query =~ s/\n/ /g;
if ($search_type eq "any") {
@words = split(/\s/, $phrase);
foreach $word (@words) {
if ($search_query =~ /\Q$word\E/i) { return 1; }
}
return 0;
}
elsif ($search_type eq "all") {
@words = split(/\s/, $phrase);
foreach $word (@words) {
unless ($search_query =~ /\Q$word\E/i) { return 0; }
}
return 1;
}
elsif ($search_type eq "exact") {
if ($search_query =~ /\Q$phrase\E/) { return 1; }
return 0;
}
elsif ($search_type eq "re") {
if ($search_query =~ /$phrase/) { return 1; }
return 0;
}
elsif ($search_type eq "advanced") {
while ($phrase =~ /([\+\-]?)(\".+?\"|\w+?\b)/gc) {
$sign = $1; $word = $2; $word =~ s/^\"(.*)\"$/$1/;
if ($sign eq "+") { push(@and_words, $word); }
elsif ($sign eq "-") { push(@not_words, $word); }
else { push(@or_words, $word); }
}
foreach $word (@not_words) {
if ($word eq lc($word) && $search_query =~ /\Q$word\E/i) { return 0; }
elsif ($search_query =~ /\Q$word\E/) { return 0; }
}
foreach $word (@and_words) {
if ($word eq lc($word) && !($search_query =~ /\Q$word\E/i)) { return 0; }
elsif (!($search_query =~ /\Q$word\E/)) { return 0; }
}
unless (@and_words) {
foreach $word (@or_words) {
if ($word eq lc($word) && $search_query =~ /\Q$word\E/i) { return 1; }
elsif ($search_query =~ /\Q$word\E/) { return 1; }
}
return 0;
}
return 1;
}
}
#!/usr/bin/perl
##############################################################################
# RPGBoard Stats version 2.10a #
# Copyleft 1999 Brendan Byrd and Resonator Software #
# Contact me at: sineswiper@resonatorsoft.com #
##############################################################################
$SIG{__DIE__} = \&tech_error;
sub tech_error {
print "Content-type: text/plain; charset=$charset\n\n";
print "ERROR: $_[0]";
exit;
}
for $j ("rpgvariables.h", "rpgglobal.h") {
unless ($k = do $j) {
&tech_error("Couldn't parse $j: $@") if $@;
&tech_error("Couldn't do $j: $!") unless defined $k;
}
}
if ($ENV{'QUERY_STRING'}) {
$ENV{'QUERY_STRING'} =~ /^(.*?)-.*$/; $forum = $1;
$sortstring = $ENV{'QUERY_STRING'};
&get_stats;
&display_table;
}
else {
&get_stats;
&display_misc_stats;
}
sub get_stats {
opendir(DEFAULTLIST,"$basedir/$defaultdir") || &tech_error("Can't open listing for $basedir/$defaultdir while reading message stats!");
@defaultlist = sort grep { /^\w*\.txt$/ } readdir(DEFAULTLIST);
closedir(DEFAULTLIST);
foreach $name (@defaultlist) {
if ($name =~ /^(\w*)\.txt$/) {
$name = $1;
if (-l "$basedir/$defaultdir/$name.txt") { next; }
&get_default;
$defaultname{$name} = $defaultname;
if ($first_post_date) {
$msgdays = int(($gmt_epoch - $first_post_date) / 86400);
if ($msgdays > $totalmsgdays) { $totalmsgdays = $msgdays; }
}
unless ($sortstring) {
if ($date_of_birth =~ /^(\d{2})\/(\d{2})\/(\d{4})$/) {
$AGE{int(&convert_date($gmt_epoch, $timezone, 0) / 10000 - "$3.$1$2")}++;
}
else { $AGE{"Not disclosed"}++; }
if ($sex) { $SEX{$sex}++; }
else { $SEX{"Not disclosed"}++; }
foreach $k (keys %stats_browser) {
if (&get_browser_info($k) =~ /^(.*) using (.*)$/) {
$BROWSER{$1} += $stats_browser{$k};
$OS{$2} += $stats_browser{$k};
}
}
}
foreach $j (sort keys %indexfile) {
if ($option{$j}) { next; }
$STATS{"$j-msgs-$name"} = int($stats_msgs{$j});
$STATS{"$j-msgs-Total"} += int($stats_msgs{$j});
$STATS{"Default-msgs-$name"} += int($stats_msgs{$j});
$STATS{"Default-msgs-Total"} += int($stats_msgs{$j});
$STATS{"$j-realmsgs-$name"} = ($stats_msgs{$j} - $stats_ntmsgs{$j});
$STATS{"$j-realmsgs-Total"} += ($stats_msgs{$j} - $stats_ntmsgs{$j});
$STATS{"Default-realmsgs-$name"} += ($stats_msgs{$j} - $stats_ntmsgs{$j});
$STATS{"Default-realmsgs-Total"} += ($stats_msgs{$j} - $stats_ntmsgs{$j});
if ($STATS{"$j-msgs-$name"}) {
$STATS{"$j-realmsgsper-$name"} = int($STATS{"$j-realmsgs-$name"} / $STATS{"$j-msgs-$name"} * 100 + .5);
$STATS{"$j-realmsgsper-Total"} = int($STATS{"$j-realmsgs-Total"} / $STATS{"$j-msgs-Total"} * 100 + .5);
$STATS{"Default-realmsgsper-$name"} = int($STATS{"Default-realmsgs-$name"} / $STATS{"Default-msgs-$name"} * 100 + .5);
$STATS{"Default-realmsgsper-Total"} = int($STATS{"Default-realmsgs-Total"} / $STATS{"Default-msgs-Total"} * 100 + .5);
}
$STATS{"$j-ntmsgs-$name"} = int($stats_ntmsgs{$j});
$STATS{"$j-ntmsgs-Total"} += int($stats_ntmsgs{$j});
$STATS{"Default-ntmsgs-$name"} += int($stats_ntmsgs{$j});
$STATS{"Default-ntmsgs-Total"} += int($stats_ntmsgs{$j});
if ($STATS{"$j-msgs-$name"}) {
$STATS{"$j-ntmsgsper-$name"} = int($STATS{"$j-ntmsgs-$name"} / $STATS{"$j-msgs-$name"} * 100 + .5);
$STATS{"$j-ntmsgsper-Total"} = int($STATS{"$j-ntmsgs-Total"} / $STATS{"$j-msgs-Total"} * 100 + .5);
$STATS{"Default-ntmsgsper-$name"} = int($STATS{"Default-ntmsgs-$name"} / $STATS{"Default-msgs-$name"} * 100 + .5);
$STATS{"Default-ntmsgsper-Total"} = int($STATS{"Default-ntmsgs-Total"} / $STATS{"Default-msgs-Total"} * 100 + .5);
}
if ($msgdays) {
$STATS{"$j-amd-$name"} = int($STATS{"$j-msgs-$name"} / $msgdays * 100 + .5) / 100;
$STATS{"Default-amd-$name"} = int($STATS{"Default-msgs-$name"} / $msgdays * 100 + .5) / 100;
}
else {
$STATS{"$j-amd-$name"} = "---";
$STATS{"Default-amd-$name"} = "---";
}
if ($totalmsgdays) {
$STATS{"$j-amd-Total"} = int($STATS{"$j-msgs-Total"} / $totalmsgdays * 100 + .5) / 100;
$STATS{"Default-amd-Total"} = int($STATS{"Default-msgs-Total"} / $totalmsgdays * 100 + .5) / 100;
}
else {
$STATS{"$j-amd-Total"} = "---";
$STATS{"Default-amd-Total"} = "---";
}
$STATS{"$j-words-$name"} = int($stats_words{$j});
$STATS{"$j-words-Total"} += int($stats_words{$j});
$STATS{"Default-words-$name"} += int($stats_words{$j});
$STATS{"Default-words-Total"} += int($stats_words{$j});
if ($STATS{"$j-msgs-$name"}) {
$STATS{"$j-awm-$name"} = int($STATS{"$j-words-$name"} / $STATS{"$j-msgs-$name"} + .5);
$STATS{"$j-awm-Total"} = int($STATS{"$j-words-Total"} / $STATS{"$j-msgs-Total"} + .5);
$STATS{"Default-awm-$name"} = int($STATS{"Default-words-$name"} / $STATS{"Default-msgs-$name"} + .5);
$STATS{"Default-awm-Total"} = int($STATS{"Default-words-Total"} / $STATS{"Default-msgs-Total"} + .5);
$STATS{"$j-score-$name"} = int(sqrt($STATS{"$j-words-$name"} * $STATS{"$j-msgs-$name"}));
$STATS{"$j-score-Total"} = int(sqrt($STATS{"$j-words-Total"} * $STATS{"$j-msgs-Total"}));
$STATS{"Default-score-$name"} = int(sqrt($STATS{"Default-words-$name"} * $STATS{"Default-msgs-$name"}));
$STATS{"Default-score-Total"} = int(sqrt($STATS{"Default-words-Total"} * $STATS{"Default-msgs-Total"}));
}
}
}
}
}
sub display_table {
print "Content-type: text/html; charset=$charset\n\n";
print "\n";
print "
\n";
print " \n";
print " \n";
print " $title{$forum} stats \n";
print "\n";
if ($standardbg) {
print "
\n";
}
else {
print "
\n";
}
print "$header\n";
print "Back
\n\n";
print "TM = Total Messages \n";
print "RM = Real Messages \n";
print "NTM = No Text Messages \n";
print "AMD = Average Messages per Day \n";
print "TW = Total Words \n";
print "AWM = Average Words per Message \n";
print "Score = sqrt(TM * TW)
\n\n";
print "$statstable\n";
print " \n";
print " \n";
print " $titlefont$title{$forum} \n";
print " \n";
print " \n";
print " $titlefont# \n";
print " $titlefontName \n";
print " $titlefontTM \n";
print " $titlefontRM \n";
print " $titlefontNTM \n";
print " $titlefontRM% \n";
print " $titlefontNTM% \n";
print " $titlefontAMD \n";
print " $titlefontTW \n";
print " $titlefontAWM \n";
print " $titlefontScore \n";
print " \n";
foreach $name (sort { $STATS{"$sortstring-$b"} <=> $STATS{"$sortstring-$a"} } @defaultlist) {
if (-l "$basedir/$defaultdir/$name.txt") { next; }
if ($STATS{"$forum-msgs-$name"} < 10) { next; }
unless ($STATS{"$sortstring-$name"} eq $STATS{"$sortstring-$prevname"}) { $count++; }
unless ($STATS{"$sortstring-$name"} && $STATS{"$sortstring-$name"} ne "---") { last; }
print " \n";
if ($count == 1) { print " $titlefont1 \n"; }
else { print " $titlefont$count \n"; }
print " $titlefont$name \n";
print " ".$STATS{"$forum-msgs-$name"}." \n";
print " ".$STATS{"$forum-realmsgs-$name"}." \n";
print " ".$STATS{"$forum-ntmsgs-$name"}." \n";
print " ".$STATS{"$forum-realmsgsper-$name"}."% \n";
print " ".$STATS{"$forum-ntmsgsper-$name"}."% \n";
print " ".$STATS{"$forum-amd-$name"}." \n";
print " ".$STATS{"$forum-words-$name"}." \n";
print " ".$STATS{"$forum-awm-$name"}." \n";
print " ".$STATS{"$forum-score-$name"}." \n";
print " \n";
$prevname = $name;
}
print " \n";
print " \n";
print " $titlefontTotal \n";
print " ".$STATS{"$forum-msgs-Total"}." \n";
print " ".$STATS{"$forum-realmsgs-Total"}." \n";
print " ".$STATS{"$forum-ntmsgs-Total"}." \n";
print " ".$STATS{"$forum-realmsgsper-Total"}."% \n";
print " ".$STATS{"$forum-ntmsgsper-Total"}."% \n";
print " ".$STATS{"$forum-amd-Total"}." \n";
print " ".$STATS{"$forum-words-Total"}." \n";
print " ".$STATS{"$forum-awm-Total"}." \n";
print " ".$STATS{"$forum-score-Total"}." \n";
print " \n";
print "\n";
&print_credits;
}
sub display_misc_stats {
print "Content-type: text/html; charset=$charset\n\n";
print "\n";
print "
\n";
print " \n";
print " \n";
print " Miscellaneous Stats \n";
print "\n";
if ($standardbg) {
print "
\n";
}
else {
print "
\n";
}
print "$header\n";
print "Sex - Age - Browser - OS - Number 1s - Back
\n";
print "$statstable\n";
print " \n";
print " $titlefontSex \n";
print " \n";
print " \n";
print " $titlefontMale \n";
print " ".int($SEX{'M'})." \n";
print " \n";
print " \n";
print " $titlefontFemale \n";
print " ".int($SEX{'F'})." \n";
print " \n";
print " \n";
print " $titlefontNot disclosed \n";
print " ".int($SEX{"Not disclosed"})." \n";
print " \n";
print "
\n";
print "$statstable\n";
print " \n";
print " $titlefontAge \n";
print " \n";
foreach $j (sort keys %AGE) {
print " \n";
print " $titlefont$j \n";
print " ".int($AGE{$j})." \n";
print " \n";
}
print "
\n";
print "$statstable\n";
print " \n";
print " $titlefontBrowsers \n";
print " \n";
foreach $j (sort { $BROWSER{$b} <=> $BROWSER{$a} } keys %BROWSER) {
print " \n";
print " $titlefont$j \n";
print " $BROWSER{$j} \n";
print " \n";
}
print "
\n";
print "$statstable\n";
print " \n";
print " $titlefontOSs \n";
print " \n";
foreach $j (sort { $OS{$b} <=> $OS{$a} } keys %OS) {
print " \n";
print " $titlefont$j \n";
print " $OS{$j} \n";
print " \n";
}
print "
\n";
print "$statstable\n";
print " \n";
print " $titlefontNumber 1s \n";
print " \n";
print " \n";
print " $titlefontName \n";
print " $titlefontForum \n";
print " $titlefontStat \n";
print " \n";
@abbr = ("msgs","realmsgs","ntmsgs","realmsgsper","ntmsgsper","amd","words","awm","score");
@long = ("Messages","Real Messages","NT Messages","Real Messages (by percentage)","NT Messages (by percentage)","Average Messages/Day","Total Words","Average Words/Message","Score");
foreach $j ((sort keys %indexfile),"Default") {
if ($option{$j}) { next; }
for ($k = 0; $k < @abbr; $k++) {
@l = sort { $STATS{"$j-$abbr[$k]-$b"} <=> $STATS{"$j-$abbr[$k]-$a"} } @defaultlist;
$l = $l[0];
print " \n";
print " $l \n";
print " $title{$j} \n";
print " $long[$k] \n";
print " \n";
}
}
print "
\n";
&print_credits;
}
#!/usr/bin/perl
##############################################################################
# RPGBoard Variables version 2.10a #
# Copyleft 1999 Brendan Byrd and Resonator Software #
# Contact me at: sineswiper@resonatorsoft.com #
##############################################################################
#####################
# Basic Information #
#####################
$godpassword = crypt("password", "xC");
######################
# Location variables #
######################
$defaultdir = "defaults";
$savedir = "saves";
$banfile = "ban.txt";
$defaultsetfile = "defaults.html";
$bgfile = "backgrounds.html";
$faqfile = "docs/faq.html";
$basemsgwidth = "70";
################
# Message Tags #
################
$msgtag{'M'} = "Mini-Spoiler";
$msgtagcolor{'M'} = "FF7F00";
$msgtag{'G'} = "Game Spoiler";
$msgtagcolor{'G'} = "red";
$msgtag{'S'} = "Story Spoiler";
$msgtagcolor{'S'} = "red";
$msgtagorder = "MGS";
$sectiontext = "If this is a spoiler, what game/section is it for";
#########################
# Configuration options #
#########################
$use_html = 2;
$use_backgrounds = 0;
$use_spellcheck = 1;
$use_spoilermsg = 1;
$use_msgtags = 1;
$use_filter = 1;
$use_email = 1;
$use_ip_display = 1;
$force_registeration = 1;
$archive_days = 30;
$compress_days = 90;
$delete_days = 0;