'; } function print_footer() { echo '
'; } print_header(); if (time() > strtotime('2007-10-05 8:00')) { echo '

Registration NCPC 2007

The registration period is now over.

List of registered teams.

'; print_footer(); exit(); } $checks = $CHECKS; // Let us use $_POST for filling out default field values to "" without // worrying about whether or not it is set. foreach ($checks as $k => $v) { if (! isset($_POST[$k])) { $_POST[$k] = ''; } } if (isset($_POST['action'])) { $action = $_POST['action']; } else { $action = ''; } if ($action == 'AddTeam') { dbQuery('BEGIN TRANSACTION'); $error = ''; unset($_POST['Add']); unset($_POST['action']); foreach ($_POST as $k => $v) { $_POST[$k] = trim(formToForm($v)); } $havemember = array( '' => TRUE, 1 => TRUE, 2 => TRUE, 3 => TRUE); foreach (array(2,3) as $C) { if ($_POST['FirstMiddle'.$C] == '' && $_POST['LastName'.$C] == '') { $havemember[$C] = FALSE; foreach ($MEMBER_CHECKS as $k => $v) { unset($checks["$k$C"]); } } } foreach ($_POST as $k => $v) { if (preg_match("(http://)", $v)) { $error .= "No URLs, please\n"; } } foreach ($checks as $field => $what) { if ($what === FALSE) continue; $value = $_POST[$field]; $type = $what[0]; $patt = $PATTERNS[$type]; $minlen = $what[1]; $maxlen = $what[2]; $needed = $what[3]; if ($needed && strlen($value) == 0) { $error .= "The field $field was not entered.\n"; } else if (strlen($value) < $minlen) { $error .= "Field $field below the minimum length of $minlen.\n"; } else if (strlen($value) > $maxlen) { $error .= "Field $field above the maximum length of $maxlen.\n"; } else { if (!preg_match($patt, $value)) { $error .= "Error prosessing field $field:\n". " '" . $value . "' does not match '$patt'\n"; } } if ($error === '' && $type === 'siteid') { if ($value === '') { $error .= "The field $field was not set.\n"; } else if ($value == 'fromteamdef') { // OK } else if (! array_key_exists($value, $SCHOOLINFO)) { $error .= "The value '$value' is not valid for $field.\n"; } } } $aff = $_POST["AffiliationID"]; $affpat = "^(?:$aff|fromteamdef)$"; $otherpat = '^(:?\\w+\\.other)$'; // Check that affiliations are sensible $some_fromteamdef = FALSE; foreach (array(1, 2, 3) as $C) if ($havemember[$C]) { if ($_POST["AffiliationID$C"] === 'fromteamdef') { $some_fromteamdef = TRUE; } } foreach (array('', 1, 2, 3) as $C) if ($havemember[$C]) { $affm = $_POST["AffiliationID$C"]; // Check that it is specified textually if and only if // "Country: Other" was chosen if (preg_match("/$otherpat/", $affm)) { if ( ($C == '' && $some_fromteamdef) || ($C != '' && $_POST["AffiliationOther"] === '') ) { if ($_POST["AffiliationOther$C"] === '') { $error .= "Affiliation was not specified"; if ($C !== '') { $error .= " for member $C (or the team)"; } else { $error .= " for the team"; } $error .= ",\n even though '" . affName($affm) . "' was selected"; if ($C == '') { $error .= ", and a member had '" . affName('fromteamdef') . "'"; } $error .= ".\n"; } } } } // Check E-mails foreach (array(1,2,3) as $C) if ($havemember[$C]) { if ($_POST['Email'.$C] != $_POST['CEmail'.$C]) { $error .= "Email addresses did not match: '" . $_POST['Email'.$C] . "' != '" . $_POST['CEmail'.$C] . "'\n"; } } // Check Kattis account foreach (array(1,2,3) as $C) if ($havemember[$C]) { if ($_POST["HaveKattisLogin$C"] === 'yes' && $_POST["KattisLogin$C"] === '') { $error .= "Kattis login was not entered for member $C, " . "but 'I have a Kattis account' was selected.\n"; } else if ($_POST["HaveKattisLogin$C"] === 'no' && $_POST["KattisLogin$C"] !== '') { $error .= "Kattis login was entered for member $C, " . "but 'I need a Kattis account' was selected.\n"; } } // Check eliglibility if ($_POST["Eliglible"] == 'yes') { if (preg_match("/$otherpat/", $_POST["AffiliationID"])) { $error .= "ICPC eliglibility selected, but team " . "has affiliation '" . affName($_POST["AffiliationID"]) . "'.\n"; } } $old = dbQuery("SELECT * FROM TEAMS WHERE teamname=".quoteForDB($_POST['TeamName']).""); if (count($old) > 0) { $error .= "Team with name '{$_POST['TeamName']}' already exists.\n"; } $used_email = array(); $used_kattislogin = array(); foreach (array(1,2,3) as $C) if ($havemember[$C]) { if (array_key_exists($_POST["Email$C"], $used_email)) { $error .= "Members cannot have the same e-mail address.\n"; } $used_email[$_POST["Email$C"]] = TRUE; $old = dbQuery("SELECT * FROM TEAMS WHERE email".$C." == ".quoteForDB($_POST["Email$C"])); if (count($old) > 0) { $error .= "Member with e-mail {$_POST["Email$C"]} already exists in database.\n"; } if ($_POST["KattisLogin$C"] !== '') { if (array_key_exists($_POST["KattisLogin$C"], $used_kattislogin)) { $error .= "Members cannot have the same Kattis logins.\n"; } $used_kattislogin[$_POST["KattisLogin$C"]] = TRUE; $old = dbQuery("SELECT * FROM TEAMS WHERE kattislogin".$C." == ". quoteForDB($_POST["KattisLogin$C"])); if (count($old) > 0) { $error .= "Member with Kattis login {$_POST["KattisLogin$C"]} already exists in database.\n"; } } } if ($error == '') { $posts = array(); foreach ($FIELD_NAMES as $f) { $posts[] = quoteForDB($_POST[$f]); } $query = "INSERT INTO teams (\n" . " " . implode(",\n ", array_merge($FIELD_NAMES, array('Country'))) . ")\n" . "VALUES (\n" . " " . implode(",\n ", array_merge($posts, array( quoteForDB($SCHOOLINFO[$_POST['AffiliationID']]['country'])))) . ")"; dbQuery($query); if ($_POST["Eliglible"] === 'yes') { $maddr = $SCHOOLINFO[$_POST['AffiliationID']]['email']; } else { $maddr = $SCHOOLINFO[$_POST['SiteID']]['email']; } $pretty = "\n" . "Registration:\n"; foreach ($FIELD_NAMES as $f) { $pretty .= ljust("$f:", 20) . $_POST[$f] . "\n"; } mail($maddr, "NCPC registration for '{$_POST['TeamName']} at '{$_POST['AffiliationID']}'", $pretty); // TODO: Change this to the technical admins mail address. mail('nils.grimsmo@idi.ntnu.no', "(backup) NCPC registration for '{$_POST['TeamName']} at '{$_POST['SiteID']}'", $pretty); echo "

Team '".escapeHTML($_POST['TeamName'])."' added.
Email sent to <$maddr>.

Go back to NCPC 2007 page,
or view registered teams.

"; $action = 'done'; /* include_once('toxml.php'); writeXML(); include_once('totext.php'); writeText(); */ dbQuery('COMMIT TRANSACTION'); } if ($error != '') { echo "

The form has the following errors:

$error
"; $action = ''; dbQuery('ROLLBACK TRANSACTION'); } } if ($action == '') { echo '

Registration NCPC 2007

List of registered teams.
Go back to NCPC 2007 page..

The registration is open until Friday 5th of October 08:00 CEST. Advance registration until Friday 28th of September 08:00 CEST. (What this implies depends on your local organiser.)

How the registration works for ICPC eliglible teams (normal students teams):

  1. You fill out the form below.
  2. The contest organiser at your school receives an e-mail with your info, and registers you in the central ICPC system.
  3. You receive an e-mail, requesting that you complete your information there.
  4. You are done!

The reason we have this multi-step system is that the ICPC requires us to verify the contestants.

For other teams:

  1. Just fill out the form below.


'; foreach (array(1,2,3) as $C) { echo ' '; if ($C < 3) { echo ' '; } } echo '
Team Name
ICPC Eliglibility Yes. (Students only. See Rules)
No.
Affiliation
Teams that have selected "Country: Other" should specify their affiliation (e.g. "IBM") below, for the team and/or the members.
Competes at site
 
A team can have 1-3 members.
  Team member '.$C.'
First Name
Last Name
Email Address
Retype Email Address
Affiliation
If you selected "Country: Other", specify:
Kattis login I have a Kattis account:
I need a Kattis account (All team members will get one since they need it for the contest).
 
 
 

Registrations will be sent to:

'; foreach ($SCHOOLINFO as $k => $v) { echo ' '; } echo '
'.$COUNTRIES[$v['country']].': '.$v['name'].' '.str_replace('@', ' ', $v['email']).'
'; } print_footer(); ?>