]> git.sesse.net Git - ccbs/blobdiff - html/start-tournament.pl
Added a function for starting a tournament (no backend yet).
[ccbs] / html / start-tournament.pl
diff --git a/html/start-tournament.pl b/html/start-tournament.pl
new file mode 100755 (executable)
index 0000000..e6386f1
--- /dev/null
@@ -0,0 +1,21 @@
+#! /usr/bin/perl
+
+use ccbs;
+use strict;
+use warnings;
+
+my $cgi = new CGI;
+my $id = $cgi->param('id');
+
+my $dbh = ccbs::db_connect();
+
+my $tournament = $dbh->selectrow_hashref('SELECT * FROM tournaments NATURAL JOIN seasons NATURAL JOIN countries NATURAL JOIN machines NATURAL JOIN scoringsystems WHERE tournament=?', undef, $id);
+my $ref = $dbh->selectrow_hashref('SELECT count(*) AS num_registered FROM tournamentparticipation WHERE tournament=?', undef, $id);
+my $num_registered = $ref->{'num_registered'};
+
+ccbs::print_header();
+ccbs::process_template('start-tournament.tmpl', $tournament->{'tournamentname'}, {
+       tournament => $tournament,
+       num_registered => $num_registered
+});
+$dbh->disconnect;