| M |
| Macedonia | Skopje |
| Madagascar | Antananarivo |
| Malawi | Lilongwe |
| Malaysia | Kuala Lumpur |
| Maldives | Male |
| Mali | Bamako |
| Malta | Valletta |
| Marshall Islands | Majuro |
| Mauritania | Nouakchott |
| Mauritius | Port Louis |
| Mexico | Mexico City |
| Micronesia | Palikir |
| Moldova | Chisinau |
| Monaco | Monaco |
| Mongolia | Ulaanbaatar |
| Montenegro | Podgorica |
| Morocco | Rabat |
| Mozambique | Maputo |
| Myanmar (Burma) | Naypyidaw |
| N |
| Namibia | Windhoek |
| Nauru | Yaren District |
| Nepal | Kathmandu |
| Netherlands | Amsterdam |
| New Zealand | Wellington |
| Nicaragua | Managua |
| Niger | Niamey |
| Nigeria | Abuja |
| North Korea | Pyongyang |
| Norway | Oslo |
| O |
| Oman | Muscat |
| P |
| Pakistan | Islamabad |
| Palau | Ngerulmud |
| Palestine | Ramallah |
| Panama | Panama City |
| Papua New Guinea | Port Moresby |
| Paraguay | Asunción |
| Peru | Lima |
| Philippines | Manila |
| Poland | Warsaw |
| Portugal | Lisbon |
| Q |
| Qatar | Doha |
| R |
| Romania | Bucharest |
| Russia | Moscow |
| Rwanda | Kigali |
| S |
| Saint Kitts and Nevis | Basseterre |
| Saint Lucia | Castries |
| Saint Vincent and the Grenadines | Kingstown |
| Samoa | Apia |
| San Marino | San Marino |
| Sao Tome and Principe | São Tomé |
| Saudi Arabia | Riyadh |
| Senegal | Dakar |
| Serbia | Belgrade |
| Seychelles | Victoria |
| Sierra Leone | Freetown |
| Singapore | Singapore |
| Slovakia | Bratislava |
| Slovenia | Ljubljana |
| Solomon Islands | Honiara |
| Somalia | Mogadishu |
| South Africa | Pretoria (administrative), Cape Town (legislative), Bloemfontein (judicial) |
| South Korea | Seoul |
| South Sudan | Juba |
| Spain | Madrid |
| Sri Lanka | Sri Jayawardenepura Kotte |
| Sudan | Khartoum |
| Suriname | Paramaribo |
| Swaziland | Mbabane |
| Sweden | Stockholm |
| Switzerland | Bern |
| Syria | Damascus |
| T |
| Taiwan | Taipei |
| Tajikistan | Dushanbe |
| Tanzania | Dodoma |
| Thailand | Bangkok |
| Timor-Leste | Dili |
| Togo | Lomé |
| Tonga | Nukuʻalofa |
| Trinidad and Tobago | Port of Spain |
| Tunisia | Tunis |
| Turkey | Ankara |
| Turkmenistan | Ashgabat |
| Tuvalu | Funafuti |
| U |
| Uganda | Kampala |
| Ukraine | Kyiv |
| United Arab Emirates | Abu Dhabi |
| United Kingdom | London |
| United States of America | Washington, D.C. |
| Uruguay | Montevideo |
| Uzbekistan | Tashkent |
| V |
| Vanuatu | Port Vila |
| Vatican City (Holy See) | Vatican City |
| Venezuela | Caracas |
| Vietnam | Hanoi |
| Y |
| Yemen | Sana'a |
| Z |
| Zambia | Lusaka |
| Zimbabwe | Harare |
";
$thiscap="";
function countryid($cinis) {
return str_replace('.', '_', str_replace(' ', '_', str_replace('"', '_', str_replace("'", "_", $cinis))));
}
function mapcapital($cincountry) {
global $capbits, $thiscap;
$retcap="";
$thiscap="";
$ctrys=explode(" title='", $cincountry);
if (sizeof($ctrys) > 1) {
$ctryiss=explode("'", $ctrys[1]);
$huhbits=explode(">" . $ctryiss[0], $capbits);
if (sizeof($huhbits) == 1) $huhbits=explode("(" . $ctryiss[0], $capbits);
if (sizeof($huhbits) > 1) {
$posthuhbits=explode("", $huhbits[1]);
if (sizeof($posthuhbits) > 1) {
$preposthuhbits=explode(" | ", $posthuhbits[1]);
$thiscap=str_replace('.', '_', str_replace(' ', '_', str_replace('"', '_', str_replace("'", "_", str_replace("'", "`", $preposthuhbits[0])))));
$retcap=str_replace("title='" . $ctryiss[0] . "", "title='" . str_replace("'", "`", $preposthuhbits[0]) . "", $cincountry);
}
}
}
return $retcap;
}
$num=0;
$countries=[];
$capitals=[];
$countryids=[];
$idisplay="";
$ititle="";
if (isset($_GET['capital_country'])) { $idisplay="visibility:hidden;"; $ititle="Anagram of capital. You choose country at left."; }
$htmlis="Country Capital Quiz
Score: 0 Goes: 0
RJM Programming
November, 2016
";
$scriptis="Country Capital Quiz \n \n \n var sprefix='', choice=-1, score=0, goes=0, num=0, capitals=[], countries=[], countryids=[]; var uprefix=\"//www.rjmprogramming.com.au/PHP/GeoChart/geo_chart.php?title=Countries&onclick=y&width=298&height=194&country=Country&popularity=Intensity&guess=&data=\"; function iframeit() { document.getElementById('dgeochart').innerHTML=''; } function checkforpost(insg, oiframe, owhere) {
var outs=insg, fbits='', anal=0, capis='';
if (oiframe == null) {
fbits='';
} else {
if (oiframe.name != '') {
fbits='';
} else {
fbits='';
}
}
if (insg.length > 950) {
var outarr=insg.split('#')[0].split('?');
if (outarr.length > 1) {
var outarrtwo=outarr[1].split('&'), oath;
for (var im=0; im','');
}
}
if (owhere == null) {
owhere=document.getElementById('mydpost');
if (owhere == null) {
if (document.getElementById('mydpost')) {
document.getElementById('mydpost').innerHTML=fbits;
setTimeout(andlater,1500);
outs=\"#\";
} else {
document.body.innerHTML+='' + fbits + '
';
setTimeout(andlater,1500);
outs=\"#\";
}
} else {
owhere.innerHTML=fbits;
setTimeout(andlater,1500);
outs=\"#\";
}
} else {
owhere.innerHTML=fbits;
setTimeout(andlater,1500);
outs=\"#\";
}
}
return outs;
}
function selchangeit(osel) {
if (osel.id == 'countrytwo') {
//alert(osel.value + ' vs ' + document.getElementById('country').value);
check(osel);
this.value='';
} else {
uprefix+=sprefix + '%20[~' + encodeURIComponent(osel.options[osel.selectedIndex].text) + '~,66]%20';
sprefix=',';
iframeit();
}
}
function andlater() { if (document.URL.indexOf('capital_country') == -1) { document.getElementById('myspost').click(); } } function setup(ins) { if (document.URL.indexOf('capital_country') == -1) { uprefix+=sprefix + '%20[~' + encodeURIComponent(ins) + '~,66]%20'; sprefix=','; iframeit(); } } function ourcomp(c1,c2) { if (c1 == c2) { return true; } var xc1=c1.replace(/_/g,' ').replace(/`/g,' '); var xc2=c2.split('-')[1].replace(/_/g,' ').replace(/`/g,' '); if (xc2.toLowerCase().indexOf(xc1.toLowerCase()) != -1 && xc1.toLowerCase().length > 3) { return true; } return false; } \n function check(inv) { if (inv.value != '') { var suffix=''; goes++; if (ourcomp(inv.value,document.getElementById('country').value)) { score++; } else { suffix=' The country ' + document.getElementById(countryids[choice]).id.replace(/_/g,' ') + '
represented by
has the capital city ' + document.getElementById(countryids[choice]).title; } if (document.getElementById('ssuffix')) { document.getElementById('ssuffix').innerHTML=suffix; suffix=''; } document.getElementById('score').innerHTML='Score: ' + score + ' Goes: ' + goes + suffix; choose(); } } \n function choose() { choice = Math.floor(Math.random() * num); document.getElementById('country').value=countryids[choice] + '-' + capitals[choice]; capis=capitals[choice]; setup(countryids[choice].replace(/_/g,' ')); document.getElementById('icapital').value=''; anal=0; if (\"" . $ititle . "\" != \"\") { document.getElementById('countrytwo').value=''; document.getElementById('icapital').placeholder=''; fit(); } setTimeout(fit, 1500); } function fit() { if (\"" . $ititle . "\" != \"\") { if (eval(-1 + anal) < capis.length) { document.getElementById('icapital').placeholder+=capis.substring(anal,eval(1 + anal)).replace('_',' '); anal++; setTimeout(fit,1500); } } else { document.getElementById('icapital').focus(); } } \n";
$seloneis="";
if (isset($_GET['capital_country'])) { $seloneis=str_replace("", "", $seloneis); }
$divis="";
foreach (glob("../tikiwiki/img/flags/*.gif") as $filename) {
$bits=explode("/", $filename);
$postbits=explode(".", $bits[-1 + sizeof($bits)]);
$idis=countryid($postbits[0]);
$outcapital=mapcapital("
");
if ($outcapital != "") {
$countries[$num]=$postbits[0];
$scriptis=str_replace("", " countries.push(\"" . str_replace("_", " ", $postbits[0]) . "\"); countryids.push(\"" . $idis . "\"); capitals.push(\"" . $thiscap . "\"); num++; \n", $scriptis);
$countryids[$num]=$idis;
$seloneis=str_replace("", "", $seloneis);
$divis=str_replace("", $outcapital . "", $divis);
$num++;
}
}
echo str_replace("