]> git.sesse.net Git - ccbs/blobdiff - html/do-edit-scores.pl
Check for scores out of range, instead of giving SQL errors.
[ccbs] / html / do-edit-scores.pl
index 1ae15471634267a1ff51290d9395222c0d9e81a8..be93df0536c9ef0871822406f37b1dd92bb1195a 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+)/) {