function analyzeChoices()
{
    #----------------------------------------------------------------------
    global $chosenEventId, $chosenCompetitionId, $chosenShow, $chosenAnything;
    $chosenEventId = getNormalParam('eventId');
    $chosenCompetitionId = getNormalParam('competitionId');
    $chosenShow = getBooleanParam('show');
    $chosenAnything = $chosenEventId || $chosenCompetitionId;
}
function analyzeChoices()
{
    #----------------------------------------------------------------------
    global $chosenEventId, $chosenRegionId, $chosenPatternHtml, $chosenPatternMysql;
    $chosenEventId = getNormalParam('eventId');
    $chosenRegionId = getNormalParam('regionId');
    $chosenPatternHtml = getHtmlParam('pattern');
    $chosenPatternMysql = getMysqlParam('pattern');
}
function analyzeChoices()
{
    #----------------------------------------------------------------------
    global $chosenCompetitionId, $chosenShow, $competitionCondition, $competitionDescription;
    $chosenCompetitionId = getNormalParam('competitionId');
    $chosenShow = getBooleanParam('show');
    $competitionCondition = competitionCondition();
    $competitionDescription = $chosenCompetitionId ? $chosenCompetitionId : "all competitions";
}
function analyzeChoices () {
#----------------------------------------------------------------------
  global $chosenUpload, $chosenConfirm, $chosenNamesFile, $chosenFilename;

  $chosenUpload      = getBooleanParam( 'upload' );
  $chosenConfirm     = getBooleanParam( 'confirm' );
  $chosenNamesFile   = getNormalParam( 'namesFile' );
  $chosenFilename    = getNormalParam( 'filename' );

}
function analyzeChoices()
{
    #----------------------------------------------------------------------
    global $chosenRegionId;
    global $chosenSingle, $chosenAverage;
    $chosenRegionId = getNormalParam('regionId');
    $chosenSingle = getBooleanParam('single');
    $chosenAverage = getBooleanParam('average');
    if (!$chosenAverage) {
        $chosenSingle = true;
    }
}
function analyzeChoices()
{
    #----------------------------------------------------------------------
    global $chosenEventId, $chosenCompetitionId, $chosenWhat, $chosenShow, $chosenWhich, $competitionCondition;
    $chosenEventId = getNormalParam('eventId');
    $chosenCompetitionId = getNormalParam('competitionId');
    $chosenWhat = getNormalParam('what');
    $chosenShow = getBooleanParam('show');
    $chosenWhich = "";
    $chosenWhich .= $chosenEventId ? $chosenEventId : "all events";
    $chosenWhich .= " in " . ($chosenCompetitionId ? $chosenCompetitionId : "all competitions");
    $competitionCondition = eventCondition() . competitionCondition();
}
function analyzeChoices()
{
    #----------------------------------------------------------------------
    global $chosenYears, $chosenRegionId, $chosenOrder;
    $chosenYears = getNormalParam('years');
    $chosenRegionId = getNormalParam('regionId');
    $chosenOrder = getNormalParam('order');
    if (getNormalParam('filter') == '') {
        $chosenYears = "only " . wcaDate('Y');
    }
    if (!preg_match('/^(date|submission)$/', $chosenOrder)) {
        $chosenOrder = 'submission';
    }
}
function analyzeChoices()
{
    #----------------------------------------------------------------------
    global $chosenEventId, $chosenRegionId, $chosenYears, $chosenShow;
    global $chosenSingle, $chosenAverage;
    $chosenEventId = getNormalParamDefault('eventId', '333');
    $chosenRegionId = getNormalParam('regionId');
    $chosenYears = getNormalParam('years');
    $chosenShow = getNormalParamDefault('show', '100 Persons');
    $chosenSingle = getBooleanParam('single');
    $chosenAverage = getBooleanParam('average');
    if (!$chosenAverage) {
        $chosenSingle = true;
    }
}
function analyzeChoices () {
#----------------------------------------------------------------------
  global $chosenId, $chosenConfirm, $chosenName, $chosenNameHtml, $chosenCountryId, $chosenGender, $chosenDay, $chosenMonth, $chosenYear, $chosenUpdate, $chosenFix;

  $chosenConfirm     = getBooleanParam( 'confirm'   );
  $chosenUpdate      = getBooleanParam( 'update'    );
  $chosenFix         = getBooleanParam( 'fix'       );
  $chosenId          = getNormalParam ( 'id'        );
  $chosenName        = getMysqlParam  ( 'name'      );
  $chosenNameHtml    = getHtmlParam   ( 'name'      );
  $chosenCountryId   = getMysqlParam  ( 'countryId' );
  $chosenGender      = getNormalParam ( 'gender'    );
  $chosenDay         = getNormalParam ( 'day'       );
  $chosenMonth       = getNormalParam ( 'month'     );
  $chosenYear        = getNormalParam ( 'year'      );

}
function analyzeChoices()
{
    #----------------------------------------------------------------------
    global $chosenRegionId, $chosenEventId, $chosenYears;
    global $chosenMixed, $chosenSlim, $chosenSeparate, $chosenHistory, $chosenMixHist;
    $chosenRegionId = getNormalParam('regionId');
    $chosenEventId = getNormalParam('eventId');
    $chosenYears = getNormalParam('years');
    $chosenMixed = getBooleanParam('mixed');
    $chosenSlim = getBooleanParam('slim');
    $chosenSeparate = getBooleanParam('separate');
    $chosenHistory = getBooleanParam('history');
    $chosenMixHist = getBooleanParam('mixHist');
    if (!$chosenSlim && !$chosenSeparate && !$chosenHistory && !$chosenMixHist) {
        $chosenMixed = true;
    }
}
function analyzeChoices()
{
    #----------------------------------------------------------------------
    global $chosenEventId, $chosenRegionId, $chosenYears, $chosenPatternHtml, $chosenPatternMysql, $chosenList, $chosenMap;
    $chosenEventId = getNormalParam('eventId');
    $chosenRegionId = getNormalParam('regionId');
    $chosenPatternHtml = getHtmlParam('pattern');
    $chosenPatternMysql = getMysqlParam('pattern');
    $chosenYears = getNormalParam('years');
    $chosenList = getBooleanParam('list');
    $chosenMap = getBooleanParam('map');
    if (!$chosenList && !$chosenMap) {
        $chosenYears = "current";
    }
    if (!$chosenMap) {
        $chosenList = true;
    }
}
function analyzeChoices () {
#----------------------------------------------------------------------
  global $chosenCompetitionId;
  global $chosenByPerson, $chosenAllResults, $chosenTop3, $chosenWinners;
  global $chosenForm, $chosenList;

  $chosenCompetitionId = getNormalParam( 'competitionId' );

  $chosenByPerson      = getBooleanParam( 'byPerson' );
  $chosenAllResults    = getBooleanParam( 'allResults' );
  $chosenTop3          = getBooleanParam( 'top3' );
  $chosenWinners       = getBooleanParam( 'winners' );
  if( !$chosenAllResults  &&  !$chosenTop3 && !$chosenByPerson )
    $chosenWinners = true;
    
  $chosenForm          = getBooleanParam( 'form' );
  $chosenList          = getBooleanParam( 'list' );
  if( !$chosenForm ) $chosenList = true;
}
function analyzeChoices()
{
    #----------------------------------------------------------------------
    global $chosenType, $chosenStatus, $chosenRegionId, $chosenOrder;
    $chosenType = getNormalParam('type');
    $chosenStatus = getNormalParam('status');
    $chosenRegionId = getNormalParam('regionId');
    $chosenOrder = getNormalParam('order');
    if (!preg_match('/^(article|report|multimedia)$/', $chosenType)) {
        $chosenType = '';
    }
    if (!preg_match('/^(date|submission)$/', $chosenOrder)) {
        $chosenOrder = 'submission';
    }
    if (!preg_match('/^(pending|accepted)$/', $chosenStatus)) {
        // Do we need a "refused" status ?
        $chosenStatus = 'pending';
    }
}
function analyzeChoices()
{
    #----------------------------------------------------------------------
    global $chosenId, $chosenConfirm, $chosenName, $chosenNameHtml, $chosenCountryId, $chosenGender, $chosenDay, $chosenMonth, $chosenYear, $chosenUpdate, $chosenFix;
    $chosenConfirm = getBooleanParam('confirm');
    $chosenUpdate = getBooleanParam('update');
    $chosenFix = getBooleanParam('fix');
    $chosenId = getNormalParam('id');
    // Gah, this is awful. We can't call getNormalParam because it refuses to
    // return anything if the parameter has a quote in it. We don't want to call
    // getMysqlParam, as we're using pdo_query throughout this file, and we don't
    // want double escaping to occur.
    $chosenName = getRawParamThisShouldBeAnException('name');
    $chosenNameHtml = getHtmlParam('name');
    $chosenCountryId = getNormalParam('countryId');
    $chosenGender = getNormalParam('gender');
    $chosenDay = getNormalParam('day');
    $chosenMonth = getNormalParam('month');
    $chosenYear = getNormalParam('year');
}
function analyzeChoices()
{
    #----------------------------------------------------------------------
    global $chosenCompetitionId, $chosenType, $chosenText, $chosenUri;
    global $chosenSubmitterName, $chosenSubmitterEmail, $chosenSubmitterComment;
    global $chosenTextHtml, $chosenUriHtml, $chosenSubmitterNameHtml, $chosenSubmitterEmailHtml, $chosenSubmitterCommentHtml;
    global $chosenRecaptchaChallenge, $chosenRecaptchaResponse;
    $chosenCompetitionId = getNormalParam('competitionId');
    $chosenType = getNormalParam('type');
    $chosenText = getMysqlParam('text');
    $chosenUri = getMysqlParam('uri');
    $chosenSubmitterName = getMysqlParam('submitterName');
    $chosenSubmitterEmail = getMysqlParam('submitterEmail');
    $chosenSubmitterComment = getMysqlParam('submitterComment');
    $chosenTextHtml = getHtmlParam('text');
    $chosenUriHtml = getHtmlParam('uri');
    $chosenSubmitterNameHtml = getHtmlParam('submitterName');
    $chosenSubmitterEmailHtml = getHtmlParam('submitterEmail');
    $chosenSubmitterCommentHtml = getHtmlParam('submitterComment');
    $chosenRecaptchaChallenge = getRawParamThisShouldBeAnException('recaptcha_challenge_field');
    $chosenRecaptchaResponse = getRawParamThisShouldBeAnException('recaptcha_response_field');
}
function saveMedium()
{
    #----------------------------------------------------------------------
    global $mediumId;
    $type = getNormalParam('type');
    $competitionId = getNormalParam('competitionId');
    $text = getMysqlParam('text');
    $link = getMysqlParam('link');
    $submitterName = getMysqlParam('submitterName');
    $submitterEmail = getMysqlParam('submitterEmail');
    $submitterComment = getMysqlParam('submitterComment');
    $command = "\n  UPDATE CompetitionsMedia\n    SET type='{$type}',\n        competitionId='{$competitionId}',\n        text='{$text}',\n        uri='{$link}',\n        submitterName='{$submitterName}',\n        submitterEmail='{$submitterEmail}',\n        submitterComment='{$submitterComment}'\n    WHERE id={$mediumId}";
    dbCommand($command);
    echo "I just did this : \n";
    echo $command;
}
function analyzeChoices()
{
    #----------------------------------------------------------------------
    global $chosenPersonId;
    $chosenPersonId = strtoupper(getNormalParam('personId'));
}
<?php

$currentSection = "persons";
$mapsAPI = true;
require_once 'includes/_framework.php';
$chosenPersonId = getNormalParam('i');
$chosenCompetitions = dbQuery("\n  SELECT \n    competition.*\n  FROM\n    Results result,\n    Competitions competition\n  WHERE 1\n    AND result.personId='{$chosenPersonId}'\n    AND competition.id = result.competitionId\n  GROUP BY\n    competition.id\n  ORDER BY\n    latitude, longitude, year, month, day");
require 'includes/_header.php';
// simple validation first...
if (!preg_match('/\\d{4}\\w{4}\\d{2}/', $chosenPersonId)) {
    showErrorMessage('Invalid WCA id Format <strong>[</strong>' . o($chosenPersonId) . '<strong>]</strong>');
    print '<p><a href="persons.php">Click here to search for people.</a></p>';
    require 'includes/_footer.php';
    die;
}
#--- Get all incarnations of the person.
$persons = dbQuery("\n  SELECT person.name personName, country.name countryName, day, month, year, gender\n  FROM Persons person, Countries country\n  WHERE person.id = '{$chosenPersonId}' AND country.id = person.countryId\n  ORDER BY person.subId\n");
#--- If there are none, show an error and do no more.
if (!count($persons)) {
    showErrorMessage('Unknown person id <strong>[</strong>' . o($chosenPersonId) . '<strong>]</strong>');
    $namepart = substr($chosenPersonId, 4, 4);
    print '<p><a href="persons.php?pattern=' . urlEncode($namepart) . '">Click to search for people with `' . o($namepart) . '` in their name.</a></p>';
    require 'includes/_footer.php';
    die;
}
#--- Get and show the current incarnation.
$currentPerson = array_shift($persons);
echo "<h1>" . o($currentPerson['personName']) . " - Map of Competitions</h1>";
echo "<h2><a href='p.php?i=" . urlEncode($chosenPersonId) . "'>Back to Competitor Page</a></h2>";
// create map markers
$markers = array();
<?php

$currentSection = 'admin';
include "../../includes/_framework.php";
$compId = getNormalParam('c');
$eventId = getNormalParam('e');
$roundId = getNormalParam('r');
$table = getNormalParam('t');
if ($table == "Scrambles") {
    $deleted = $wcadb_conn->boundCommand("DELETE FROM Scrambles WHERE competitionId=? AND eventId=? AND roundId=?", array('sss', &$compId, &$eventId, &$roundId));
}
if ($table == "Results") {
    $deleted = $wcadb_conn->boundCommand("DELETE FROM Results WHERE competitionId=? AND eventId=? AND roundId=?", array('sss', &$compId, &$eventId, &$roundId));
}
if ($table == "All") {
    $deleted = $wcadb_conn->boundCommand("DELETE FROM Results WHERE competitionId=?", array('s', &$compId));
    $deleted = $wcadb_conn->boundCommand("DELETE FROM Scrambles WHERE competitionId=?", array('s', &$compId));
}
print '<span style="color:#A00;"><strong>Removed.</strong></span>';
<?php

include "../../includes/_framework.php";
$compId = getNormalParam('c');
$deleted = $wcadb_conn->boundCommand("DELETE FROM InboxResults WHERE competitionId=?", array('s', &$compId));
$deleted = $wcadb_conn->boundCommand("DELETE FROM InboxPersons WHERE competitionId=?", array('s', &$compId));
// delete scrambles using the other interface
// $deleted = $wcadb_conn->boundCommand(
//    "DELETE FROM Scrambles WHERE competitionId=?",
//     array('s', &$compId)
//   );
print "Removal attempted.";
function showPreregList()
{
    #----------------------------------------------------------------------
    global $chosenCompetitionId;
    if (getBooleanParam('isPreregSubmit')) {
        savePreregForm();
    }
    $eventId = getNormalParam('eventId');
    if ($eventId) {
        showPsychSheet($eventId);
        return;
    }
    echo "<h1>Registered competitors</h1><br />";
    #--- Get the data.
    $preregs = dbQuery("SELECT * FROM Preregs WHERE competitionId = '{$chosenCompetitionId}' AND status='a' ORDER BY countryId, name");
    $competition = getFullCompetitionInfos($chosenCompetitionId);
    #--- Get all events of the competition.
    $eventList = getEventSpecsEventIds($competition['eventSpecs']);
    $headerEvent = "";
    $headerEventLink = "";
    foreach ($eventList as $event) {
        $headerEvent .= "|{$event}";
        $headerEventLink .= "|<a href='c.php?list=1&competitionId={$chosenCompetitionId}&eventId={$event}'>{$event}</a>";
    }
    for ($i = 3; $i < 3 + count($eventList); $i++) {
        $tableStyle[$i] = 'class="c"';
    }
    $tableStyle[3 + count($eventList)] = 'class="f"';
    tableBegin('results', 4 + count($eventList));
    $countPerson = 0;
    $countCountry = 0;
    foreach ($preregs as $prereg) {
        extract($prereg);
        if (!($countPerson % 20)) {
            if ($countPerson) {
                tableHeader(explode('|', "#|Person|Citizen of{$headerEvent}|"), $tableStyle);
            } else {
                if (isset($standAlone)) {
                    tableHeader(explode('|', "#|Person|Citizen of{$headerEvent}|"), $tableStyle);
                } else {
                    tableHeader(explode('|', "#|Person|Citizen of{$headerEventLink}|"), $tableStyle);
                }
            }
        }
        $countPerson += 1;
        #--- Compute the row.
        $row = array($countPerson);
        if ($personId) {
            if (preg_match('/competition_registration.php/', $_SERVER['PHP_SELF'])) {
                $row[] = "<a target='_blank' class='p' href='p.php?i={$personId}'>{$name}</a>";
            } else {
                $row[] = personLink($personId, $name);
            }
        } else {
            $row[] = $name;
        }
        $row[] = $countryId;
        if (!isset($listCountries[$countryId])) {
            $listCountries[$countryId] = 1;
            $countCountry += 1;
        }
        $personEvents = 0;
        $eventIdsList = array_flip(explode(' ', $eventIds));
        foreach ($eventList as $event) {
            if (isset($eventIdsList[$event])) {
                $row[] = 'X';
                $countEvents[$event] = isset($countEvents[$event]) ? $countEvents[$event] + 1 : 1;
                $personEvents += 1;
            } else {
                $row[] = '-';
            }
        }
        $row[] = $personEvents;
        tableRow($row);
    }
    $row = array('', 'Total', $countCountry);
    foreach ($eventList as $event) {
        if (isset($countEvents[$event])) {
            $row[] = $countEvents[$event];
        } else {
            $row[] = 0;
        }
    }
    $row[] = '';
    tableHeader($row, $tableStyle);
    tableEnd();
}
<?php

$currentSection = 'admin';
include "../../includes/_framework.php";
$compId = getNormalParam('competitionId');
$compIdUrl = getNormalParam('competitionId');
// Load competition data from the database and check ID
$competition_data = $wcadb_conn->boundQuery("SELECT * FROM Competitions WHERE id=?", array('s', &$compId));
if (count($competition_data) != 1) {
    noticeBox3(1, 'Please select a competition.');
    die;
}
$competition_data = $competition_data[0];
print "<div class='notice'>\n          Working with `{$compIdUrl}` Competition Data\n          | <a href='/competitions/{$compId}'>Competition Results Page</a>\n          | <a href='/competitions/{$compId}/edit/admin'>Competition Admin Page</a> <br />\n        </div>";
// Alert about any existing result/scramble data
$competition_has_results = $wcadb_conn->boundQuery("SELECT * FROM Results WHERE competitionId=? LIMIT 1", array('s', &$compId));
$competition_has_scrambles = $wcadb_conn->boundQuery("SELECT * FROM Scrambles WHERE competitionId=? LIMIT 1", array('s', &$compId));
$competition_has_inbox_results = $wcadb_conn->boundQuery("SELECT * FROM InboxResults WHERE competitionId=? LIMIT 1", array('s', &$compId));
$competition_has_inbox_persons = $wcadb_conn->boundQuery("SELECT * FROM InboxPersons WHERE competitionId=? LIMIT 1", array('s', &$compId));
if (count($competition_has_inbox_results) > 0 || count($competition_has_inbox_persons) > 0) {
    noticeBox3(1, "This competition is in the process of having result data uploaded.\n                 <a href='scripts/remove_imported_data.php?c={$compIdUrl}' class='call_and_refresh'>Clear the temporary Results/Person data below...</a>");
}
// if there is no data at all, nothing has been uploaded, so let's not display anything:
$competition_has_scrambles = $wcadb_conn->boundQuery("SELECT * FROM Scrambles WHERE competitionId=? LIMIT 1", array('s', &$compId));
if (count($competition_has_scrambles) == 0 && count($competition_has_inbox_results) == 0 && count($competition_has_results) == 0 && count($competition_has_inbox_persons) == 0) {
    noticeBox3(1, 'This competition has no data yet.  Upload something to get started.');
    die;
}
print "<div id='upload_help_container' class='thick-outlined'>";
print "<ol id='result-upload-list'>";
// print "<li><p>(todo) Perform some initial sanity checks: show table of temporary rounds vs scrambles vs # competitors, etc?</p></li>";
function analyzeChoices () {
#----------------------------------------------------------------------
  global $chosenCheck;

  $chosenCheck = getNormalParam( 'check' );
}