X-Git-Url: https://git.sesse.net/?p=ccbs;a=blobdiff_plain;f=html%2Fdo-add-tournament.pl;fp=html%2Fdo-add-tournament.pl;h=ddacad5c8677b34a9ad6ed88d517bb2424a6d09d;hp=0000000000000000000000000000000000000000;hb=ed24825456ae9c1621b3ccc4d2b2c6a8ed343b4e;hpb=682984b549e3e4d53ebe5cc50202226445cf4e60 diff --git a/html/do-add-tournament.pl b/html/do-add-tournament.pl new file mode 100755 index 0000000..ddacad5 --- /dev/null +++ b/html/do-add-tournament.pl @@ -0,0 +1,28 @@ +#! /usr/bin/perl + +use ccbs; +use strict; +use warnings; + +my $dbh = ccbs::db_connect(); +my $cgi = new CGI; + +my $season = $cgi->param('season'); +my $name = $cgi->param('name'); +my $country = $cgi->param('country'); +my $place = $cgi->param('place'); +my $date = $cgi->param('date'); +my $machine = $cgi->param('machine'); +my $scoringsystem = $cgi->param('scoringsystem'); + +if ($date !~ /^ ( \d{4} - \d\d - \d\d ) $/x) { + die "Ugyldig dato (må være på YYYY-MM-DD)"; +} + +$dbh->do('INSERT INTO tournaments (season, tournamentname, country, location, date, machine, scoringsystem) VALUES (?,?,?,?,?,?,?)', + undef, $season, $name, $country, $place, $date, $machine, $scoringsystem); + +ccbs::print_header(); +ccbs::process_template('do-add-tournament.tmpl', 'Legg til turnering', {}); + +$dbh->disconnect;