#!/usr/bin/perl require 'ladmanager.pl'; $globalbusycheck=&GlobalBusyStatus(1); #$busycheck=&LadderBusyStatus($laddername); #$globalbusycheck=0; if ($globalbusycheck==0) { $timeshiftinhours=&CheckTimeShift(); if (defined($ENV{'QUERY_STRING'})) { $lineinput=$ENV{'QUERY_STRING'}; @linepairs = split(/&/, $lineinput); foreach $linepair (@linepairs) { ($name, $value) = split(/=/, $linepair); $value =~ tr/+/ /; $LINEFORM{$name} = $value; } } #Read in configuration file to get ladder data. open(CONFIG, "< $ladconfigfile"); @cfglines=; close(CONFIG); $counter=0; @laddernames=(); @laddershortnames=(); @ladtypes=(); foreach $cfgline (@cfglines) { chop($cfgline); if ($counter==0) { (undef,undef,undef,$numladders)=split(/\t/,$cfgline); } else { ($laddername,$laddershortname,$ladtype,undef)=split(/\t/,$cfgline,4); push @laddernames, $laddername; push @laddershortnames, $laddershortname; push @ladtypes, $ladtype; } $counter++; } #Check for cookie info for showing the current view preferences in the output. if (defined($ENV{ 'HTTP_COOKIE' })) { $cookieinfo=$ENV{ 'HTTP_COOKIE' }; # Split the name-value pairs from the line input IF necessary @cookiepairs = split(/; /, $cookieinfo); foreach $cookiepair (@cookiepairs) { ($cookiename, $cookievalue) = split(/=/, $cookiepair); $cookievalue =~ tr/+/ /; $COOKIEFORM{$cookiename} = $cookievalue; } } if($COOKIEFORM{'Ladderview'}) { ($mainwindpref,undef)=split(/~/,$COOKIEFORM{'Ladderview'}); } else { # Set the default value $mainwindpref=-1; } if (defined($COOKIEFORM{'LadderID'})) { ($username,undef)=split(/~/,$COOKIEFORM{'LadderID'}); } # First get the required other values based on the ladder referred to. $laddervalidflag=0; # Give the URL line precedence so a user can view other ladders other than what is in their cookie. # only use the Ladder cookie preference if no ladder specified in the cgi call URL. if (defined($LINEFORM{'ladder'})) { for ($i=0;$i<@laddershortnames;$i++) { if ($laddershortnames[$i] eq $LINEFORM{'ladder'}) { $laddername=$laddernames[$i]; $laddershortname=$laddershortnames[$i]; $ladtype=$ladtypes[$i]; $laddervalidflag=1; } } } elsif ($mainwindpref>0) { $laddername=$laddernames[$mainwindpref-1]; $laddershortname=$laddershortnames[$mainwindpref-1]; $ladtype=$ladtypes[$mainwindpref-1]; $laddervalidflag=1; } else { $laddershortname="none"; } # Print out a content-type for HTTP/1.0 compatibility print "Content-type: text/html\n\n"; &PrintHeaders("main"); # Begin alert special announcement. #print < # #
ATTENTION! SPECIAL MESSAGE FOR ALL PARTICIPANTS!!!
#February 13, 2003
#LGC Executive Director decision:

#NO matches played before Feb 13, 2003 are to be reported to the ladder. #
#Inactivity penalties have been deactivated until February 20.
#No inactivity penalties incurred as a result of the downtime.
#The ladder is back in good shape and here for all to use.
#
#Happy Valentine's Day! -blutch

#Note from LN2: I declare the ladders reopened for ladder play. Play on!!!
#For a more detailed report about this decision please read blutch's complete letter to the LGC #HERE. # #
# #EOF # end alert special announcement. print "\n"; print "\n
\n"; ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =gmtime(time-($timeshiftinhours*3600)); print ""; $year=$year+1900; print "Welcome " . $username . " !    " . $daysofweek[$wday] . ", " . $monthsofyear[$mon] . " " . $mday . ", " . $year . "

"; print "\n"; print < EOF if ($laddervalidflag==1) { #means a certain ladder was selected to view # Check for inactivities &CheckInactives($laddershortname); print "\n\n"; print "\n"; print "\n\n"; # Read in data from the ladder and print the names for the Top 30. $filename=$maindatapath . $laddershortname . "/" . $leaderboarddatfile; open(FILE, "< $filename"); @lines=; close(FILE); @names=('-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-','-'); @streaklist=(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0); $counter=0; foreach $line (@lines) { chop($line); ($name, undef, undef, undef, undef, undef, $streak, undef) = split(/\t/,$line,8); if ($counter<21) { $names[$counter]=$name; $streaklist[$counter]=$streak; } $counter++; } # Show top 21 if individual ladder, only top 10 if team ladder....team ladders won't be as large so no need to show top 21. print ""; print ""; } else { print "\n\n\n"; } #endif print < EOF print "\n"; #Start announcements column print <


"; print "\"board\""; print "\"Stats\""; print "\"Reportloss\"


Top "; if ($ladtype==0) { print "21 Leaders\n"; print "
\n"; print ""; $counter=0; for ($i=0;$i<3;$i++) { print ""; } print ""; print "

"; for ($j=0;$j<7;$j++) { if ($streaklist[$counter]>4) { print ""; print $counter+1 . " " . $names[$counter] . "
"; } elsif ($streaklist[$counter]<-4) { print ""; print $counter+1 . " " . $names[$counter] . "
"; } else { print $counter+1 . " " . $names[$counter] . "
"; } $counter++; } print "
"; } # end if ladtype==0 if ($ladtype==1) { print "10 Leaders\n"; print "
\n"; print ""; $counter=0; for ($i=0;$i<2;$i++) { print ""; } print ""; print "

"; for ($j=0;$j<5;$j++) { if ($streaklist[$counter]>4) { print ""; print $counter+1 . " " . $names[$counter] . "
"; } elsif ($streaklist[$counter]<-4) { print ""; print $counter+1 . " " . $names[$counter] . "
"; } else { print $counter+1 . " " . $names[$counter] . "
"; } $counter++; } print "
"; } # end if ladtype==1 print "
\nWelcome, please select a ladder from the menu above.

EOF open(FILE, "< $ladannouncefile"); @lines=; close(FILE); $i=0; $noprintannouncementflag=0; foreach $line (@lines) { chop($line); $ladannounce=$line; # print "noprintannouncementflag = " . $noprintannouncementflag . "i = " . $i . "

"; if ($ladannounce eq "None" and $i==0) { $noprintannouncementflag=1; } # Need a special if condition just to get headers printed only once if at all. if ($noprintannouncementflag==0 and $i==0) { print ""; print "
"; print "Announcements

"; print "\n"; print "\n
\n"; print "
\n"; print "\n\n
"; print $ladannounce; } if ($noprintannouncementflag==0 and $i!=0) { print $ladannounce; } $i++; } print "
"; if ($noprintannouncementflag==0) { print "\n
\n
\n
\n"; print "
"; } print <
ribbon EOF print "" . $smlogoimagetag; print < PGAtour.com Fantasy Golf
United
We Stand!
LGC Home PGA Tour Yahoo
Fantasy Golf

EOF # Print out the last 3 days of news and match results for the ladder selected if there was one selected. if ($laddervalidflag==1) { print "\n"; print "\n
\n"; # Read in ladder news $filename=$maindatapath . $laddershortname . "/" . $newsdat; open(FILE, "< $filename"); @newslines=; close(FILE); # Read in match history $filename=$maindatapath . $laddershortname . "/" . $matchhistdat; open(FILE, "< $filename"); @lines=; close(FILE); print "\n"; for ($numdays=0;$numdays<3;$numdays++) { # First let's get the selected month, year, and day to use as a criteria. ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) =gmtime(time-($timeshiftinhours*3600)-($numdays*86400)); # Ladder news criteria selection for display. @todaysladnews=(); foreach $newsline (@newslines) { if ($numdays==0) { chop($newsline); } ($dayname, $dayofmonth, $month, $yyyear, $news) = split(/\t/,$newsline); # if same day(today) then we want to update the today arrays so then we can display them on the main page. if ($dayofmonth==$mday and $month==$mon and $yyyear==$year) { push @todaysladnews, $news; } } print ""; print "\n"; @todayswinners=(); @todayswinranks=(); @todayslosers=(); @todaysloserranks=(); @comments=(); @todayschangeskillpts=(); foreach $line (@lines) { if ($numdays==0) { chop($line); } ($winname, $winrank, $losername, $loserrank, $changepts, $dayname, $dayofmonth, $month, $yyyear, $comment) = split(/\t/,$line); # if same day(today) then we want to update the today arrays so then we can display them on the main page. if ($dayofmonth==$mday and $month==$mon and $yyyear==$year) { push @todayswinners, $winname; push @todayswinranks, $winrank; push @todayslosers, $losername; push @todaysloserranks, $loserrank; push @todayschangeskillpts, $changepts; $comment =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $comment =~ s/\"/"/g; $comment =~ s/'/\\'/g; push @comments, $comment; } } print "\n\n"; print "\n"; } #end big for loop # bgcolor=\"#CCFF00\" print "


"; if ($numdays==0) { print "Today's "; } elsif ($numdays==1) { print "Yesterday's "; } else { print $daysofweek[$wday] . "'s "; } print "News

"; print "\n"; $size=@todaysladnews; if ($size==0) { print ""; } for ($j=0;$j<$size;$j++) { print "\n\n"; } print "
"; print "None"; print "
"; print $todaysladnews[$j] . "
\n


"; if ($numdays==0) { print "Today's "; } elsif ($numdays==1) { print "Yesterday's "; } else { print $daysofweek[$wday] . "'s "; } print "Results

"; print "\n"; $size=@todayswinners; if ($size==0) { print ""; } for ($j=0;$j<$size;$j++) { print ""; } print "
"; print "None played"; print "
"; print $todayswinners[$j] . " ( " . $todayswinranks[$j] . " ) defeated " . $todayslosers[$j] . " ( "; print $todaysloserranks[$j] . " ) -- " . $todayschangeskillpts[$j] . " pts "; if ($comments[$j] ne 'n') { print ""; print ""; } print "
\n

"; print "\n"; print "

\n"; if ($numdays!=2) { print "\n"; print "\n
\n"; } print "
\n"; print "
\n
\n"; } &PrintFooter("main"); &GlobalBusyStatus(0); } #end main code