Check for scores out of range, instead of giving SQL errors.
authorSteinar H. Gunderson <sesse@samfundet.no>
Wed, 16 Feb 2005 18:44:23 +0000 (18:44 +0000)
committerSteinar H. Gunderson <sesse@samfundet.no>
Wed, 16 Feb 2005 18:44:23 +0000 (18:44 +0000)
html/do-edit-scores.pl

index 1ae1547..be93df0 100755 (executable)
@@ -24,6 +24,10 @@ for my $p ($cgi->param()) {
        undef $val if ($val =~ /^\s*$/);
 
        if ($p =~ /^score(\d+)-(\d+)/) {
+               if (defined($val) && ($val < 0 || $val > 10000)) {
+                       ccbs::user_error("Alle poengsummer må være mellom 0 og 10000 (inklusive).");
+               }
+       
                $dbh->do('UPDATE scores SET score=? WHERE tournament=? AND round=? AND parallel=? AND player=? AND songnumber=?', undef,
                        $val, $tournament, $round, $group, $1, $2);
        } elsif ($p =~ /^playmode(\d+)-(\d+)/) {