#!/usr/bin/perl $_=$ENV{'QUERY_STRING'}; $item=""; if (/\-/) { @ddw=split(/\-/,$_); $who=$ddw[0]; $item=$ddw[1]; } else { $who=$ENV{'QUERY_STRING'}; } $whodat=$who; if ($who==0) { print "Location: http://www.baseballgeeks.com\n\n"; } print "Set-Cookie: startup=$who; path=/;\n"; $mn[1]="January"; $mn[2]="February"; $mn[3]="March"; $mn[4]="April"; $mn[5]="May"; $mn[6]="June"; $mn[7]="July"; $mn[8]="August"; $mn[9]="September"; $mn[10]="October"; $mn[11]="November"; $mn[12]="December"; open (WHO, "bbs/users/blogs/$who"); @ft=; close(WHO); $numft=@ft; open (CFG,"bbs/users/blogs/$who.cfg"); @cfg=; close(CFG); $numcfg=@cfg; $out1=chr(13); $out2=chr(10); for ($ix=0; $ix<$numcfg; $ix++) { $_=$cfg[$ix]; s/$out1//g; s/$out2//g; $cfg[$ix]=$_; } $cfg[0]++; open (CFG,"bbs/users/blogs/$who.hts"); @hits=; close(CFG); $_=$hits[0]; s/$out1//g; s/$out2//g; $hits[0]=$_; $hits[0]++; $numsitehits=$hits[0]; open (CFG,">bbs/users/blogs/$who.hts"); print CFG "$hits[0]\n"; close(CFG); open (CFG,"bbs/users/$who"); @bloguser=; close(CFG); $numblogusr=@bloguser; $out1=chr(13); $out2=chr(10); for ($ix=0; $ix<$numblogusr; $ix++) { $_=$bloguser[$ix]; s/$out1//g; s/$out2//g; $bloguser[$ix]=$_; } if ($numblogusr==0) { print "Location: http://www.baseballgeeks.com\n\n"; } if ($numcfg) { open (HITS, ">bbs/users/blogs/$who.cfg"); for ($ix=0; $ix<$numcfg; $ix++) { print HITS "$cfg[$ix]\n"; } close(HITS); } $blogwho=$who; if ($bloguser[17] != 1) { $cfg[2]="www.baseballgeeks.com/cgi-bin/blog?$who"; } #if ($cfg[4] eq "") { # $cfg[4] = "arial"; #} if ($cfg[5] eq "") { $cfg[5] = "gray"; } #if ($cfg[6] eq "") { # $cfg[6] = "white"; #} if ($cfg[7] eq "") { $cfg[7] = "beige"; } if ($cfg[8] eq "") { $cfg[8] = "#ccccff"; } if ($cfg[9] eq "") { $cfg[9] = "arial"; } if ($cfg[10] eq "") { $cfg[10] = "black"; } if ($cfg[11] eq "") { $cfg[11] = "arial"; } if ($cfg[12] eq "") { $cfg[12] = "black"; } if ($cfg[16] eq "") { $cfg[16] = "#ccccff"; } if ($cfg[17] eq "") { $cfg[17] = "blue"; } if ($cfg[18] eq "") { $cfg[18] = "Georgia"; } if ($cfg[19] eq "") { $cfg[19] = "black"; } if ($cfg[3] == 0 or $cfg[3]<0) { $cfg[3]=10; } $pgs2=$numft/$cfg[3]; $pgs=int($numft/$cfg[3]); $pgs3=$pgs2-$pgs; if ($pgs3>0) { $pgs++; } $lo=0; if ($item<0) { $item=0; } if ($item) { $lo=$item; if ($lo<0 or $lo>$numft) { $lo=0; } } $hi=$lo+$cfg[3]; if ($hi>$numft) { $hi=$numft; } $prev=$lo-$cfg[3]; if ($prev<0) { $prev=0; } $nextone=""; $prevone=""; $bottomprev=""; $bottomnext=""; if ($item > 0) { #then, there is a previous; it is "prev" - prev=lo $amtprev=$item-$prev; $amtend="IES"; if ($amtprev==1) { $amtend="Y"; } $prevone="[PREVIOUS $amtprev ENTR$amtend]

"; $bottomprev=""; } if ($hi<$numft) { #then there is a next, next=$hi+1 $amtnext=$hi; $dumhi=$hi+$cfg[3]; if ($dumhi > $numft) { $dumhi=$numft; } $hmamtnext=$dumhi-$hi; $amtend="IES"; if ($hmamtnext==1) { $amtend="Y"; } $nextone="[NEXT $hmamtnext ENTR$amtend]

"; $bottomnext=""; } open(CFG,"bbs/bbsconfig"); while () { chomp($_); $config[$ct]=$_; $ct++; } close(CFG); $guestsok=0; if ($config[18]==1) { $guestsok=1; $u[11]=1; } @mfields=("ma","num"); $mct=0; open (MSGS,"bbs/msgconfig"); while () { chomp($_); if (/\^/) { #if not the instruction line or blank spaces @msgs{@mfields}=split(/\^/,$_); $mct++; $msga[$mct]=$msgs{'ma'}; $msgan[$mct]=$msgs{'num'}; } } close(MSGS); #if no cookie, then end the page if ($ENV{'HTTP_COOKIE'} eq "") { $anycookie=0; if ($guestsok) { $anycookie=2; } } #cookies{num}, cookies{start} num = user number start is true if #started from opening page my(%cookies) = getCookies(); if ($cookies{'num'}>0) { $uindex=0; open (INPUT, "bbs/users/$cookies{'num'}"); while () { $uindex++; chop(); $u[$uindex] = $_; } close (INPUT); } $anycookie=1; if ($cookies{'num'} == 0) { $anycookie=0; if ($guestsok) { $anycookie=2; } } else { @fieldlist = ("name","pass","number"); $wefoundpass=1; $pass=uc($cookies{'pass'}); open (IN, ") { chop(); $regular = $_; @data{@fieldlist} = split(/\^/,$regular); if ($data{'number'} == $cookies{'num'}) { $pass2=uc($data{'pass'}); if ($pass ne $pass2) { $anycookie=0; if ($guestsok) { $anycookie=2; } } else { $wefoundpass=0; last; } } } close (IN); if ($wefoundpass) { $anycookie=0; if ($guestsok) { $anycookie=2; } } } print "Content-type: text/html\n\n"; if ($bloguser[17] == 1) { open (HTM, "bbs/users/blogs/$who.htm"); @htm=; close(HTM); if ($htm[0]) { $numhtm=@htm; for ($iii=0; $iii<$numhtm; $iii++) { $_=$htm[$iii]; s/$out1//g; s/$out2//g; #print qq(-$_-

\n); $commnd=0; $line=""; if ($_ eq "[**BLOGENTRIES**]") { PrintBlogEntries(); } if ($_ eq "[**PREVENTRIES**]") { PrevEntry(); } if ($_ eq "[**XML**]") { print qq(\n); $commnd=1; } if ($_ eq "[**HITS**]") { print qq($numsitehits\n); $commnd=1; } if ($commnd==0) { print qq($htm[$iii]); } } print qq(

Site Meter
\n); exit; } } #else { #if no special code if ($cfg[1]) { $blogtitle=$cfg[1]; } else { $blogtitle="BaseballGeeks Blogs >> $bloguser[0]"; } #$also=" onLoad=\"self.focus();document.entry.name.focus()\""; #if ($anycookie) { # $also=""; #} if ($cfg[6]) { $also="background=\"http://$cfg[6]\""; } if ($u[11]==1) { $where="topics.pl?$ix"; $where2="topics.pl?"; } else { $where="messages.pl?$ix-$u[22+$ix]"; $where2="messages.pl?"; } #cfg6=bgcolor # border-top-color:blue; # border-bottom-color:red; # border-left-color:yellow; #$tempcfg=$cfg[5]; #if ($cfg[4] eq "black") { # $tempcfg=white; #} #if ($cfg[4] eq "white" or $cfg[5] eq "") { # $tempcfg=$black; #} #$vlink="blue"; #$alink="blue"; #$link="blue"; #if ($cfg[6] eq "blue") { #$vlink="red"; #$alink="red"; #$link="red"; #} print qq( $blogtitle
\n); if ($cfg[15]) { print qq(
$cfg[14]
A BASEBALLGEEKS BLOG    
\n); } else { print qq(
$blogtitle
A BASEBALLGEEKS BLOG    
\n); } print qq(
\n); if ($cfg[15] eq "") { print qq(
$cfg[14]

\n); } print qq(
\n); PrintBlogEntries(); print qq(

\n); if ($cookies{'num'} == $blogwho) { print qq(Hey, $bloguser[0]. Click here to edit your blog configuration (colors, etc.).

\n); } if ($cookies{'num'}==0) { print qq(
BASEBALLGEEKS LOGIN

Name
Pass
New Users
\n); } else { if ($cookies{'num'} != $blogwho) { print qq(

Welcome, $u[1]!
\n); } } if ($line) { print qq(

NAVIGATE/ARCHIVE

\n); #navigate stuff print qq(

$line
\n); } open (CL, "blogads"); @cls=; close(CL); $numcls=@cls; if ($numcls > 9) { $numcls=10; } $whiledummy=0; while ($numrands != $numcls) { $whiledummy++; if ($whiledummy>500) { exit; } $random=int(rand($numcls)); $nooops=1; for ($jj=0; $jj<$numrands; $jj++) { if ($ad[$jj] eq $cls[$random]) { $nooops=0; } } if ($nooops) { $ad[$numrands]=$cls[$random]; $numrands++; } } @adfields=("title","link","threadnum","msg","expire"); for ($ix=0; $ix<$numcls;$ix++) { $_=$ad[$ix]; s/$rem1//g; s/$rem2//g; @addata{@adfields}=split(/\^/,$_); open (CLSTHD,"threads/$addata{'threadnum'}"); @clsthd=; close(CLSTHD); $numclsthd=@clsthd; for ($qqq=0; $qqq<$numclsthd; $qqq++) { $_=$clsthd[$qqq]; s/$rem1//g; s/$rem2//g; $clsthd[$qqq]=$_; } print qq(
$addata{'title'}
Comments ($clsthd[1])
\n); } #$dacats=1; #for ($be=0; $be<$numft; $be++) { # @bep=split(/\^/,$ft[$be]); # if ($bep[1]) { # for ($chkc=1; $chkc<$dacats+1; $chkc++) { # if ($bep[1] ne $mycats[$chkc] and $bep[1] ne "") { # $mycats[$dacats]=$bep[1]; # $dacats++; # } # } # } #} if ($dacats>1) { print qq(
BLOG CATEGORIES

\n); for ($cc=1; $cc<$dacats; $cc++) { print qq($mycats[$cc]

\n); } print qq(

\n); } print qq(
BGEEK BLOG UPDATES

\n); $features=0; @ft=""; open (FT, "updatedblogs"); while () { s/$rem1//g; s/$rem2//g; @parts=split(/\^/,$_); $whichblog[$features]=$parts[0]; $ft[$features]=$parts[1]; $features++; } close(FT); $totf=$features; if ($totf>10) { $totf=10; } for ($ix=0; $ix<$totf; $ix++) { @daf=split(/-/,$ft[$ix]); open (MSG, "bbs/$daf[0]/$daf[1]"); @message=; close(MSG); $eeee=@message; open (USR, "bbs/users/$message[0]"); @uu=; close(USR); $_=$message[0]; s/$rem1//g; s/$rem2//g; @msgzele=split(/\^/,$_); $message[0]=$msgzele[0]; $contest=$msgzele[1]; $chopsubj=$message[4]; ChopSubject(); if ($message[1] == 0) { $amsg=$daf[1]; } else { $amsg=$message[1]; } if ($message[0]) { $who="$message[3]"; } else { $who=$message[3]; } if ($u[11] == 1 or $anycookie==0) { $whtp="thread.pl"; } else { $whtp="onethread.pl"; } #$reps2=""; @teste=split(/\(/,$message[5]); $message[5]=$teste[0]; open (CFG,"bbs/users/blogs/$whichblog[$ix].cfg"); @ubloguser=; close(CFG); $numublogusr=@ubloguser; for ($xix=0; $xix<$numublogusr; $xix++) { $_=$ubloguser[$xix]; s/$rem1//g; s/$rem2//g; $ubloguser[$xix]=$_; } open (USR, "bbs/users/$whichblog[$ix]"); @ubu=; close(USR); $_=$ubu[0]; s/$rem1//g; s/$rem2//g; $ubu[0]=$_; if ($ubloguser[1] eq "") { $ubloguser[1]=$ubu[0]."'s Blog"; } print qq(\n); } print qq(
$ubloguser[1]
$chopsubj-[$cfg[10]]

OTHER LINKS/BLOGROLL

\n); open (ROLL, "bbs/users/blogs/$blogwho.br"); while () { s/$rem1//g; s/$rem2//g; @blogroll=split(/\^/,$_); print qq(\n); } close(ROLL); print qq(
$blogroll[0]

\n); exit; sub ChopSubject { $leng = length($chopsubj); $pp=""; $dum=0; for ($iiii=0; $iiii<$leng; $iiii++) { $part = substr($chopsubj,$iiii,1); $pp = $pp . $part; if ($part eq "[") { $dum = 1; last; } } if ($dum) { chop($pp); } chop($pp); $chopsubj = $pp; $_ = $chopsubj; #$a = s/Re: //; #$message[4] = $_; $a = s/ 120) { $last; $cut=1; last; } } $writetext=$writetext.$a; if ($a eq ">") { $flag=0; } } $addwt=""; $addwtt=""; $_=$writetext; $aaaa=s/&box-//g; $bbbb=s/-box&//g; if ($bbbb eq "") { $bbbb=0; } $cccc=$aaaa-$bbbb; for ($dddd=1; $dddd<$cccc+1; $dddd++) { $addwtt=$addwtt."-box&"; } if ($cut) { $addwt=$addwt."...".$reps3.$addwtt; } else { $addwt=$addwt."

"; } $writetext=$writetext.$addwt.$reps2; #$rem=$rem1.$rem2; #$_=$writetext; #s/$rem/

/g; #$writetext=$_; #$rem=" "; #$_=$writetext; #s/$rem/

/g; $junky="&::&&::&"; $junky2="&::&"; $junky3=":&:&"; $junky4=":&"; $repjunky2="
"; $repjunky="

"; $_=$writetext; s/$junky/$repjunky/g; s/$junky2/$repjunky2/g; s/$junky3/$repjunky/g; s/$junky4//g; $writetext=$_; $repaired=$writetext; #$repaired =~ s/:\)//g; #$repaired =~ s/:\(//g; #$repaired =~ s/;\)//g; #$repaired =~ s/:\)//g; #$repaired =~ s/:\(//g; #$repaired =~ s/;\)//g; if ($cfg[4] eq "" or $cfg[4] eq "." or $cfg[4] eq "YES") { $repaired =~ s/&img-/

<\/center>

/g; $repaired =~ s/&box-/

\n); # } sub getCookies { my(%cookies); foreach (split (/; /, $ENV{'HTTP_COOKIE'})) { my($key) = split(/=/, $_); $cookies{$key} = substr($_, index($_, "=")+1); } return(%cookies) } sub PrintBlogEntries { for ($oooo=$lo; $oooo<$hi; $oooo++) { #if ($oooo != $lo) { #print qq(

			#	
\n); #} if ($oooo==$lo) { $testpage=$lo/$cfg[3]; $testpage2=int($lo/$cfg[3]); if ($testpage == $testpage2 and $testpage != 0) { $testpage3=$testpage2+1; $line="PAGE $testpage3/$pgs

"; } if ($prevone) { $line=$line.$prevone; if ($nextone eq "") { $ucblog=uc($cfg[1]); $line=$line." [$ucblog FIRST PAGE]"; } } if ($nextone) { $line=$line.$nextone; } #if ($line) { # print qq(

/g; $repaired =~ s/-box&/<\/font><\/td><\/tr><\/table><\/td><\/tr><\/table><\/center>

/g; $repaired =~ s/&i-//g; $repaired =~ s/-i&/<\/i>/g; $repaired =~ s/&b-//g; $repaired =~ s/-b&/<\/b>/g; $repaired =~ s/&u-//g; $repaired =~ s/-u&/<\/u>/g; $repaired =~ s/&rj-/

/g; $repaired =~ s/-rj&/<\/div>/g; print qq($repaired ); # print qq(
$writetext
$line

\n); # } } @df=split(/-/,$ft[$oooo]); @cf=split(/\^/,$df[1]); $df[1]=$cf[0]; $_=$df[1]; s/$out1//g; s/$out2//g; $df[1]=$_; $_=$cf[1]; s/$out1//g; s/$out2//g; $cf[1]=$_; open (MSG, "bbs/$df[0]/$df[1]"); @message=; close(MSG); $eeee=@message; for ($xxo=0; $xxo<6; $xxo++) { $_=$message[$xxo]; s/$out1//g; s/$out2//g; $message[$xxo]=$_; } @msgf=split(/,/,$message[5]); @msgff=split(/\//,$msgf[0]); $month=$mn[$msgff[0]]; $date=$month. " ".$msgff[1].", "."20".$msgff[2]; $chopsubj=$message[4]; ChopSubject(); if ($message[1] == 0) { $amsg=$df[1]; } else { $amsg=$message[1]; } @fieldlist2=("num","msgs"); $reps=0; open (MSG,"bbs/$df[0]/index"); while () { chop(); @b{@fieldlist2}=split(/:/,$_); if ($b{'num'} == $amsg) { @dareps=split(/\^/,$b{'msgs'}); $reps=@dareps; last; } } close(MSG); #if ($amsg != 0) { # $reps++; #} $comments=""; if ($reps > 1 or $reps==0) { $comments="s"; } $fixreps=$reps-1; open (MS, "bbs/$df[0]/$dareps[$reps-1]"); @msg=; close(MS); $_=$msg[3]; s/$out1//g; s/$out2//g; $msg[3]=$_; $_=$msg[5]; s/$out1//g; s/$out2//g; $msg[5]=$_; @msgfive=split(/\(/,$msg[5]); $msg[5]=$msgfive[0]; $lastreply=""; if ($msg[3] and $fixreps>-1) { @spmsg=split(/\^/,$msg[3]); $msg[3]=$spmsg[0]; $lastreply="Last comment by: $msg[3] @ $msg[5]"; } if ($anycookie) { $who="$message[3]"; $delentry=""; if ($cookies{'num'} == $blogwho) { $delentry=">> Delete * >> * >> *"; } $amsgadd="$amsg#$df[1]"; if ($df[1] == $amsg) { $amsgadd=$amsg; } $reps2="
$reps comment$comments >> Link $delentry  
$lastreply

"; $reps3="

...[More]

"; $reps=$reps. "      Go to this topic"; } else { $who=$message[3]; } @teste=split(/\(/,$message[5]); $message[5]=$teste[0]; $category="$cf[1]"; print qq(
\n); if ($cf[1] and $cookies{'num'} != $blogwho) { print qq(\n); } else { if ($cookies{'num'} == $blogwho) { print qq(\n); } } @partm=split(/\^/,$message[3]); $message[3]=$partm[0]; print qq(
  $date   $category  
 

$chopsubj
(By: $message[3])

\n); PrintMsg(); print qq(

\n); } print qq(

$bottomprev       $bottomnext
\n); $commnd=1; } sub PrevEntry { $addi="Click a link below to jump to a specific page of blog entries ($cfg[3] per page), or click the NEXT ENTRIES or PREVIOUS ENTRIES links to jump to the closest page(s) of entries."; if ($pgs==1) { $addi="This is the only page of blog entries thus far."; } print qq(
$numft blog entries from this blog are currently stored in the BaseballGeeks Bulletin Board System.

$addi

\n); if ($pgs>1) { print qq(
\n); for ($xxd=0; $xxd<$pgs; $xxd++) { $nextn=$cfg[3]*$xxd; if ($nextn>$numft) { $nextn=$numft; } $nextnu=$xxd+1; if ($nextn == $item) { print qq($nextnu \n); } else { print qq($nextnu \n); } if ($xxd < $pgs-1) { print qq(. \n); } } print qq(
\n); } print qq(

\n); $commnd=1; } sub MakeNext { $line=""; $testpage=$lo/$cfg[3]; $testpage2=int($lo/$cfg[3]); if ($testpage == $testpage2 and $testpage != 0) { $testpage3=$testpage2+1; $line="PAGE $testpage3/$pgs

"; } if ($prevone) { $line=$line.$prevone; if ($nextone eq "") { $ucblog=uc($cfg[1]); $line=$line." [$ucblog FIRST PAGE]

"; } } if ($nextone) { $line=$line.$nextone; } if ($line) { print qq(

$line
\n); } }