]> ruin.nu Git - ndwebbie.git/blobdiff - points.pl
more fatal warnings and other cleanup
[ndwebbie.git] / points.pl
index c75130c361fbab5390f54d065d3b17c67045ac33..213fad9d84069e0e3f41d9dd26b229b37fe17e9a 100644 (file)
--- a/points.pl
+++ b/points.pl
@@ -18,6 +18,7 @@
 #**************************************************************************/
 
 use strict;
+use warnings FATAL => 'all';
 
 $ND::TEMPLATE->param(TITLE => 'Top Members');
 
@@ -28,7 +29,7 @@ our $LOG;
 die "You don't have access" unless isMember();
 
 my $type = "total";
-if (param('type') =~ /^(defense|attack|total|humor|scan|rank)$/){
+if (defined param('type') && param('type') =~ /^(defense|attack|total|humor|scan|rank)$/){
        $type = $1;
 }
 $type .= '_points' unless ($type eq 'rank');
@@ -43,9 +44,11 @@ my $query = $DBH->prepare("SELECT username,defense_points,attack_points,scan_poi
 $query->execute;
 
 my @members;
+my $i = 0;
 while (my ($username,$defense,$attack,$scan,$humor,$total,$rank) = $query->fetchrow){
+       $i++;
        push @members,{Username => $username, Defense => $defense, Attack => $attack
-               , Scan => $scan, Humor => $humor, Total => $total, Rank => $rank};
+               , Scan => $scan, Humor => $humor, Total => $total, Rank => $rank, ODD => $i % 2};
 }
 $BODY->param(Members => \@members);