DENMARK DEN CROATIA CRO LATVIA LAT BULGARIA BUL SLOVAKIA SLO YUGOSLAVIA YUG EAST GERMANY GDR LIECHTENSTEIN LIE UNIFIED TEAM AT OLYMPICS EUN CZECHOSLOVAKIA TCH RUSSIA URS WEST GERMANY FRG SWITZERLAND SUI NETHERLANDS NED GERMANY GER UNITED STATES OF AMERICA EUA AFGHANISTAN AFG ALBANIA ALB ALGERIA DZA ANDORRA AND ANGOLA AGO ANTIGUA AND BARBUDA ATG ARGENTINA ARG ARMENIA ARM AUSTRALIA AUS AUSTRIA AUT AZERBAIJAN AZE BAHAMAS BHS BAHRAIN BHR BANGLADESH BGD BARBADOS BRB BELARUS BLR BELGIUM BEL BELIZE BLZ BENIN BEN BHUTAN BTN BOLIVIA BOL BOSNIA AND HERZEGOVINA BIH BOTSWANA BWA BRAZIL BRA BULGARIA BGR BURKINA FASO BFA BURUNDI BDI CAMBODIA KHM CAMEROON CMR CANADA CAN CAPE VERDE CPV CENTRAL AFRICAN REP CAF CHAD TCD CHILE CHL CHINA CHN COLOMBIA COL COMOROS COM CONGO COG COOK ISLANDS COK COSTA RICA CRI CÔTE D'IVOIRE CIV CROATIA HRV CUBA CUB CYPRUS CYP CZECH REP CZE DEM PEOPLE'S REP OF KOREA PRK DEM REP OF THE CONGO COD DENMARK DNK DJIBOUTI DJI DOMINICA DMA DOMINICAN REP DOM ECUADOR ECU EGYPT EGY EL SALVADOR SLV EQUATORIAL GUINEA GNQ ERITREA ERI ESTONIA EST ETHIOPIA ETH FAROE ISLANDS FRO FIJI FJI FINLAND FIN FRANCE FRA GABON GAB GAMBIA GMB GEORGIA GEO GERMANY DEU GHANA GHA GREECE GRC GRENADA GRD GUATEMALA GTM GUINEA GIN GUINEA-BISSAU GNB GUYANA GUY HAITI HTI HONDURAS HND HUNGARY HUN ICELAND ISL INDIA IND INDONESIA IDN IRAN (ISLAMIC REP OF) IRN IRAQ IRQ IRELAND IRL ISRAEL ISR ITALY ITA JAMAICA JAM JAPAN JPN JORDAN JOR KAZAKHSTAN KAZ KENYA KEN KIRIBATI KIR KUWAIT KWT KYRGYZSTAN KGZ LAO PEOPLE'S DEM REP LAO LATVIA LVA LEBANON LBN LESOTHO LSO LIBERIA LBR LIBYA LBY LITHUANIA LTU LUXEMBOURG LUX MADAGASCAR MDG MALAWI MWI MALAYSIA MYS MALDIVES MDV MALI MLI MALTA MLT MARSHALL ISLANDS MHL MAURITANIA MRT MAURITIUS MUS MEXICO MEX MICRONESIA (FED STATES OF) FSM MONACO MCO MONGOLIA MNG MONTENEGRO MNE MOROCCO MAR MOZAMBIQUE MOZ MYANMAR MMR NAMIBIA NAM NAURU NRU NEPAL NPL NETHERLANDS NLD NEW ZEALAND NZL NICARAGUA NIC NIGER NER NIGERIA NGA NIUE NIU NORWAY NOR OMAN OMN PAKISTAN PAK PALAU PLW PANAMA PAN PAPUA NEW GUINEA PNG PARAGUAY PRY PERU PER PHILIPPINES PHL POLAND POL PORTUGAL PRT QATAR QAT REP OF KOREA KOR REP OF MOLDOVA MDA ROMANIA ROU RUSSIAN FEDERATION RUS RWANDA RWA SAINT KITTS AND NEVIS KNA SAINT LUCIA LCA SAINT VINCENT AND THE GRENADINES VCT SAMOA WSM SAN MARINO SMR SAO TOME AND PRINCIPE STP SAUDI ARABIA SAU SENEGAL SEN SERBIA SRB SEYCHELLES SYC SIERRA LEONE SLE SLOVAKIA SVK SLOVENIA SVN SOLOMON ISLANDS SLB SOMALIA SOM SOUTH AFRICA ZAF SPAIN ESP SRI LANKA LKA SUDAN SDN SURINAME SUR SWAZILAND SWZ SWEDEN SWE SWITZERLAND CHE SYRIAN ARAB REP SYR TAJIKISTAN TJK TFYR OF MACEDONIA MKD THAILAND THA TIMOR-LESTE TLS TOGO TGO TONGA TON TRINIDAD AND TOBAGO TTO TUNISIA TUN TURKEY TUR TURKMENISTAN TKM TUVALU TUV UGANDA UGA UKRAINE UKR UNITED ARAB EMIRATES ARE UNITED KINGDOM GBR UNITED REP OF TANZANIA TZA UNITED STATES OF AMERICA USA URUGUAY URY UZBEKISTAN UZB VANUATU VUT VENEZUELA (BOLIVARIAN REP OF) VEN VIET NAM VNM YEMEN YEM ZAMBIA ZMB ZIMBABWE ZWE "; $yeararr = array(); $cityarr = array(); $sportarr = array(); $disciplinearr = array(); $countrycodearr = array(); $countryarr = array(); $eventarr = array(); $genderarr = array(); $typearr = array(); $woarr = array(); $things = array("year", "city", "sport", "discipline", "country", "event", "gender", "type"); function codeincountryout($cisin) { global $ccodelist; $countryout = $cisin; $xout = explode("" . $cisin . "<", $ccodelist); if (sizeof($xout) == 2) { $xoutagain = explode(">", $xout[0]); $countryout = str_replace("" . $cisin . "<", $ccodelist); if (sizeof($xout) == 2) { $xoutagain = explode(">", $xout[1]); $countryout = str_replace("= "0" && substr($fields[0] . " ",0,1) <= "9") { if (strlen($po) > 0 && strpos($po, ",") !== false && strpos($lines[$i], $po) !== false) $po = ($i + 0 - $offset); $woarr[($i + 0 - $offset)] = $lines[$i]; if (strpos($yearlist, "'" . $fields[0] . "'") === false) $yeararr[sizeof($yeararr)] = $fields[0]; if (strpos($citylist, '"' . $fields[1] . '"') === false) $cityarr[sizeof($cityarr)] = $fields[1]; if (strpos($sportlist, "'" . $fields[2] . "'") === false) $sportarr[sizeof($sportarr)] = $fields[2]; if (strpos($disciplinelist, "'" . $fields[3] . "'") === false) $disciplinearr[sizeof($disciplinearr)] = $fields[3]; if (strpos($countrycodelist, '"' . str_replace("EUA", "USA", $fields[4]) . '"') === false) $countrycodearr[sizeof($countrycodearr)] = str_replace("EUA", "USA", $fields[4]); if (strpos($countrylist, '"' . str_replace("EUA", "USA", $fields[4]) . '"') === false) $countryarr[sizeof($countryarr)] = codeincountryout(str_replace("EUA", "USA", $fields[4])); if (strlen($fields[6]) > 1) { if (strpos($eventlist, "'" . $fields[5] . "," . $fields[6] . "'") === false) $eventarr[sizeof($eventarr)] = $fields[5] . "," . $fields[6]; if (strpos($genderlist, "'" . $fields[7] . "'") === false) $genderarr[sizeof($genderarr)] = $fields[7]; if (strpos($typelist, "'" . $fields[8] . "'") === false) $typearr[sizeof($typearr)] = $fields[8]; } else { if (strpos($eventlist, "'" . $fields[5] . "'") === false) $eventarr[sizeof($eventarr)] = $fields[5]; if (strpos($genderlist, "'" . $fields[6] . "'") === false) $genderarr[sizeof($genderarr)] = $fields[6]; if (strpos($typelist, "'" . $fields[7] . "'") === false) $typearr[sizeof($typearr)] = $fields[7]; } if (strpos($yearlist, "'" . $fields[0] . "'") === false) $yearlist .= ""; if (strpos($citylist, '"' . $fields[1] . '"') === false) $citylist .= ''; if (strpos($sportlist, "'" . $fields[2] . "'") === false) $sportlist .= ""; if (strpos($disciplinelist, "'" . $fields[3] . "'") === false) $disciplinelist .= ""; if (strpos($countrycodelist, '"' . str_replace("EUA", "USA", $fields[4]) . '"') === false) $countrycodelist .= '"; if (strpos($countrylist, '"' . str_replace("EUA", "USA", $fields[4]) . '"') === false) $countrylist .= '"; if (strlen($fields[6]) > 1) { if (strpos($eventlist, "'" . $fields[5] . "+" . $fields[6] . "'") === false) $eventlist .= ""; if (strpos($genderlist, "'" . $fields[7] . "'") === false) $genderlist .= ""; if (strpos($typelist, "'" . $fields[8] . "'") === false) $typelist .= ""; } else { if (strpos($eventlist, "'" . $fields[5] . "'") === false) $eventlist .= ""; if (strpos($genderlist, "'" . $fields[6] . "'") === false) $genderlist .= ""; if (strpos($typelist, "'" . $fields[7] . "'") === false) $typelist .= ""; } $wolist .= ""; $tot = ($i + 0 - $offset); } } } } $tot = 0; $po = ""; if (!isset($_POST['stage'])) { // first off if (isset($_GET['pickone'])) { $po = urldecode($_GET['pickone']); } $yearlist = ""; $wolist .= "

"; if (isset($_GET['score']) && isset($_GET['goes'])) { echo "Winter Olympics Game ... Score: " . $_GET['score'] . " Goes: " . $_GET['goes'] . "

Winter Olympics Game ... Score: " . $_POST['score'] . " Goes: " . $_POST['goes'] . "


"; } else { echo "Winter Olympics Game

Winter Olympics Game


"; } echo "
\n"; echo $wolist; echo $yearlist . $citylist . $sportlist . $disciplinelist . $eventlist . $countrycodelist . $countrylist . $genderlist . $typelist; echo "
"; if (isset($_GET['score']) && isset($_GET['goes'])) { echo ""; echo ""; } else { echo ""; echo ""; } echo ""; echo ""; echo ""; if ($po != "" || isset($_GET['pickone'])) { if ($po == "") { echo "\n document.getElementById('wosel').value = '" . $woarr[rand(1, $tot)] . "'; document.getElementById('submit').click(); "; } else { if (substr($po,0,1) >= "0" && substr($po,0,1) <= "9") { echo "\n document.getElementById('wosel').value = '" . $woarr[$po] . "'; document.getElementById('submit').click(); "; } else { echo "\n document.getElementById('wosel').value = '" . $woarr[rand(1, $tot)] . "'; document.getElementById('submit').click(); "; } } } //echo ""; //echo "
"; echo "\n window.open('https://www.google.com.au/search?q=%22Winter+Olympics%22&biw=1280&bih=625&source=lnms&tbm=isch&sa=X&ei=mPFmVNriNqLXmgXxu4KoCQ&ved=0CAYQ_AUoAQ', '_blank', 'top=400,left=20,width=300,height=500'); window.open('https://www.google.com.au/search?q=%22Winter+Olympics%22&biw=1280&bih=625&tbm=vid&source=lnms&sa=X&ei=pvFmVOLnGuSNmwWcuICYCg&ved=0CAkQ_AUoAg&dpr=1', '_blank', 'top=400,left=320,width=300,height=500'); window.open('https://www.google.com.au/?gfe_rd=cr&ei=kPFmVIf7OMqN8QeXtIDQBw&gws_rd=ssl#q=%22Winter+Olympics%22', '_blank', 'top=400,left=620,width=900,height=500'); "; echo ""; } else if (isset($_POST['stage'])) { $yearlist = "
\n"; $sportlist = "\n"; $countrycodelist = "\n"; $eventlist = "\n"; $typelist = "\n"; $pageContent = file_get_contents("http://isithackday.com/medals.csv"); $pageContent .= "\n2002,Salt Lake City,Skating,Short Track S.,AUS,1000m,M,Gold\n"; $pageContent .= "\n2002,Salt Lake City,Skiing,Aerial Skiing,AUS,Aerials,W,Gold\n"; populate($pageContent); $yearlist .= "  "; $citylist .= "  "; $sportlist .= "  "; $disciplinelist .= "  "; $countrycodelist .= ""; $countrylist .= "  "; $eventlist .= "  "; $genderlist .= "  "; $typelist .= "
"; $wolist .= "

"; if ($_POST['stage'] == "0") { // have selected from first dropdown but not answered yet echo "Winter Olympics Game ... Score: " . $_POST['score'] . " Goes: " . $_POST['goes'] . "

Winter Olympics Game ... Score: " . $_POST['score'] . " Goes: " . $_POST['goes'] . "


"; echo "
\n"; echo str_replace(urldecode($_POST['wosel']) . "'", urldecode($_POST['wosel']) . "' selected", $wolist); $ii = 0; $sij = ";"; $ij = rand(0,7); $cols = explode(",", urldecode($_POST['wosel'])); while ($ii < 5) { while (strpos($sij, $ij . ";") !== false) { $ij = rand(0,7); } $sij .= ($ij . ";"); echo ""; if ($ij == 1 || $ij == 4) { $xx = '$' . $things[$ij] . 'list = str_replace(""; echo ""; echo ""; echo ""; echo "

"; echo "
"; echo ""; } else { // check answer $score = $_POST['score']; $goes = 1 + $_POST['goes']; $yearlist = ""; $wolist .= "

"; $xurl = '#'; $aurl = "https://www.google.com.au/?gfe_rd=cr&ei=GthlVPz3O8yN8QeBsoHQCA&gws_rd=ssl#q=" . urlencode($_POST['wosel']); if (urldecode($_POST['wosel']) == urldecode($_POST['yearsel'] . ',' . $_POST['citysel'] . ',' . $_POST['sportsel'] . ',' . $_POST['disciplinesel'] . ',' . $_POST['countrysel'] . ',' . $_POST['eventsel'] . ',' . $_POST['gendersel'] . ',' . $_POST['typesel'])) { $score = 1 + $_POST['score']; echo "Winter Olympics Game ... Score: " . $score . " Goes: " . $goes . "

Winter Olympics Game ... Score: " . $score . " Goes: " . $goes . "


"; echo "

Great work ... optional research can start here



"; } else if (strpos($wolist, urldecode($_POST['yearsel'] . ',' . $_POST['citysel'] . ',' . $_POST['sportsel'] . ',' . $_POST['disciplinesel'] . ',' . $_POST['countrysel'] . ',' . $_POST['eventsel'] . ',' . $_POST['gendersel'] . ',' . $_POST['typesel'])) !== false) { $score = 1 + $_POST['score']; $aurl = "https://www.google.com.au/?gfe_rd=cr&ei=GthlVPz3O8yN8QeBsoHQCA&gws_rd=ssl#q=" . urldecode($_POST['yearsel'] . ',' . $_POST['citysel'] . ',' . $_POST['sportsel'] . ',' . $_POST['disciplinesel'] . ',' . $_POST['countrysel'] . ',' . $_POST['eventsel'] . ',' . $_POST['gendersel'] . ',' . $_POST['typesel']); echo "Winter Olympics Game ... Score: " . $score . " Goes: " . $goes . "

Winter Olympics Game ... Score: " . $score . " Goes: " . $goes . "


"; echo "

Great work ... optional research can start here



"; } else { echo "Winter Olympics Game ... Score: " . $score . " Goes: " . $goes . "

Winter Olympics Game ... Score: " . $score . " Goes: " . $goes . "


"; echo "

Sorry ... you said " . urldecode($_POST['yearsel'] . ',' . $_POST['citysel'] . ',' . $_POST['sportsel'] . ',' . $_POST['disciplinesel'] . ',' . $_POST['countrysel'] . ',' . $_POST['eventsel'] . ',' . $_POST['gendersel'] . ',' . $_POST['typesel']) . "
            ... but answer is " . $_POST['wosel'] . " ... optional research can start here



"; } echo "
\n"; echo $wolist; echo $yearlist . $citylist . $sportlist . $disciplinelist . $eventlist . $countrycodelist . $countrylist . $genderlist . $typelist; echo "
"; echo ""; echo ""; echo ""; echo ""; echo ""; echo ""; } } ?>