]> git.sesse.net Git - ccbs/commitdiff
Add backend code for adding tournaments.
authorSteinar H. Gunderson <sesse@samfundet.no>
Mon, 14 Feb 2005 14:32:42 +0000 (14:32 +0000)
committerSteinar H. Gunderson <sesse@samfundet.no>
Mon, 14 Feb 2005 14:32:42 +0000 (14:32 +0000)
html/do-add-tournament.pl [new file with mode: 0755]
html/templates/do-add-tournament.tmpl [new file with mode: 0644]

diff --git a/html/do-add-tournament.pl b/html/do-add-tournament.pl
new file mode 100755 (executable)
index 0000000..ddacad5
--- /dev/null
@@ -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;
diff --git a/html/templates/do-add-tournament.tmpl b/html/templates/do-add-tournament.tmpl
new file mode 100644 (file)
index 0000000..35d242c
--- /dev/null
@@ -0,0 +1,4 @@
+[%# vim:set filetype=html: %]
+<div>
+  <p>Turneringen er lagt til.</p>
+</div>