]> git.sesse.net Git - ccbs/blob - html/do-add-tournament.pl
Restore inadvertedly removed rm -f.
[ccbs] / html / do-add-tournament.pl
1 #! /usr/bin/perl
2
3 use ccbs;
4 use strict;
5 use warnings;
6
7 ccbs::admin_only();
8
9 my $dbh = ccbs::db_connect();
10 my $cgi = new CGI;
11
12 my $season = $cgi->param('season');
13 my $name = $cgi->param('name');
14 my $country = $cgi->param('country');
15 my $place = $cgi->param('place');
16 my $date = $cgi->param('date');
17 my $machine = $cgi->param('machine');
18 my $scoringsystem = $cgi->param('scoringsystem');
19
20 if ($date !~ /^ ( \d{4} - \d\d - \d\d ) $/x) {
21         ccbs::user_error("Ugyldig dato (må være på formen YYYY-MM-DD).");
22 }
23
24 $dbh->do('INSERT INTO tournaments (season, tournamentname, country, location, date, machine, scoringsystem) VALUES (?,?,?,?,?,?,?)',
25         undef, $season, $name, $country, $place, $date, $machine, $scoringsystem);
26
27 ccbs::print_header();
28 ccbs::process_template('do-add-tournament.tmpl', 'Legg til turnering', {});
29
30 $dbh->disconnect;