";
$dssuffix="";
$arr_browsers = ["MSIE", "Edge"]; // thanks to https://artisansweb.net/detect-browser-php-javascript/
$agent = $_SERVER['HTTP_USER_AGENT'];
foreach ($arr_browsers as $browser) {
if (strpos($agent, $browser) !== false) {
$dsprefix="";
$dssuffix="";
break;
}
}
$preget="";
$alturlis="//www.rjmprogramming.com.au/PHP/GeoChart/geo_chart.php?title=CITYGOESHERE&onclick=y&width=149&height=97&country=City&popularity=Intensity&aregeographicals=y&guess=&data=%20[LAT|LONG|~CITYGOESHERE~,1]%20";
function data_unify($what) {
//$what=str_replace(' "', '"', $what);
//$what=str_replace("<", " <", $what);
$what=str_replace("Saint Helena, Ascension, And Tristan Da Cunha", "Saint Helena and Ascension and Tristan Da Cunha", $what);
$what=str_replace(" And ", " and ", $what);
$what=str_replace(" and the ", " and The ", $what);
$what=str_replace("South Georgia and The South Sandwich Islands", "South Georgia and South Sandwich Islands", $what);
$what=str_replace("Congo, The Democratic Republic of", "Democratic Republic of the Congo", $what);
$what=str_replace("Congo, The Republic of", "The Republic of the Congo", $what);
$what=str_replace("Congo (Kinshasa)", "Democratic Republic of the Congo", $what);
$what=str_replace("Congo (Brazzaville)", "The Republic of the Congo", $what);
$what=str_replace("Cote D'Ivoire", "Côte D’Ivoire", $what);
$what=str_replace("Ivory Coast", "Côte D’Ivoire", $what);
$what=str_replace("Bahamas, The", "Bahamas", $what);
$what=str_replace("Gambia, The", "Gambia", $what);
$what=str_replace("Czech Republic", "Czechia", $what);
$what=str_replace("The Bahamas", "Bahamas", $what);
$what=str_replace("The Gambia", "Gambia", $what);
$what=str_replace("Moldova, Republic of","Moldova", $what);
$what=str_replace("Iran, Islamic Republic of","Iran", $what);
$what=str_replace("Brunei Darussalam", "Brunei", $what);
$what=str_replace("Lao People's Democratic Republic", "Laos", $what);
$what=str_replace("Lao PDR","Laos",$what);
$what=str_replace("Tanzania, United Republic of","Tanzania",$what);
$what=str_replace("Iran, Islamic Republic of","Iran",$what);
$what=str_replace("Macedonia, the Former Yugoslav Republic of","Macedonia",$what);
$what=str_replace("Korea, Democratic People's Republic of","North Korea",$what);
$what=str_replace("Korea, Republic of","South Korea",$what);
$what=str_replace("Korea, North","North Korea",$what);
$what=str_replace("Korea, South","South Korea",$what);
$what=str_replace("Korea (North)","North Korea",$what);
$what=str_replace("Korea (South)","South Korea",$what);
$what=str_replace("Libyan Arab Jamahiriya","Libya",$what);
$what=str_replace("Micronesia, Federated States of", "Micronesia", $what);
$what=str_replace("Micronesia, Federated States Of", "Micronesia", $what);
$what=str_replace("East Timor", "Timor-Leste", $what);
$what=str_replace("Russian Federation","Russia",$what);
$what=str_replace("Syrian Arab Republic","Syria",$what);
$what=str_replace("Netherlands Antilles","Netherlands",$what);
$what=str_replace("United States Minor Outlying Islands", "United States", $what);
$what=str_replace("Palestinian Territory","Palestine", $what);
$what=str_replace("West Bank","Palestine", $what);
$what=str_replace("Virgin Islands, U.S.","United States", $what);
$what=str_replace("Virgin Islands, British","United Kingdom", $what);
return $what;
}
function getih($indefe) {
global $preget;
$preget='';
if ($indefe == "XW") { $indefe="PS"; }
if ($indefe == "AN") { $indefe="NL"; }
if ($indefe == "Federated States Of") { $indefe="FM"; }
if (strlen(trim($indefe)) == 2) { $preget='|' . trim(strtoupper($indefe)); };
$lri="ABCDEFGHIJKLMNOPQRSTUVWXYZ^$";
$zri="abcdefghijklmnopqrstuvwxyz^$0123456789#@!~`";
$dri=["127462","127463","127464","127465","127466","127467","127468","127469","127470","127471","127472","127473","127474","127475","127476","127477","127478","127479","127480","127481","127482","127483","127484","127485","127486","127487","127988","917631"];
$sri=["917601","917602","917603","917604","917605","917606","917607","917608","917609","917610","917611","917612","917613","917614","917615","917616","917617","917618","917619","917620","917621","917622","917623","917624","917625","917626","127988","917631","30","31","32","33","34","35","36","37","38","39","127937","65039","8205","127752","127987"];
$thiscc=$indefe;
$ccsuff='';
$ccchar=' ';
$cde='';
for ($iccsuff=0; $iccsuff" . str_replace("+"," ",urldecode($_POST['thiscity'])) . " is in " . str_replace("+"," ",urldecode($_POST['eanswer'])) . " but is not in " . str_replace("+"," ",urldecode($_POST['ucountry'])) . ".";
}
if (isset($_POST['emailfrom'])) {
$emdef=str_replace("+"," ",urldecode($_POST['emailfrom']));
}
} else if (isset($_GET['thiscity']) && isset($_GET['ucountry']) && isset($_GET['eanswer'])) {
if ($_GET['ucountry'] == $_GET['eanswer']) {
$egoes="1 Well done! " . str_replace("+"," ",urldecode($_GET['thiscity'])) . " is indeed in " . str_replace("+"," ",urldecode($_GET['eanswer'])) . ".";
$escore="1";
} else {
$egoes="1 Sorry, " . str_replace("+"," ",urldecode($_GET['thiscity'])) . " is in " . str_replace("+"," ",urldecode($_GET['eanswer'])) . " but is not in " . str_replace("+"," ",urldecode($_GET['ucountry'])) . ".";
}
if (isset($_GET['emailfrom'])) {
$emdef=str_replace("+"," ",urldecode($_GET['emailfrom']));
}
}
$citiesarr=[];
$uniquecountries=",";
$countriesarr=[];
$countriesisotwo=[];
$ctyisotwo=file_get_contents("http://www.nationsonline.org/oneworld/country_code_list.htm");
$ctyisotwo=str_replace("Lao PDR","Laos",$ctyisotwo);
$ctyisotwo=str_replace("Tanzania, United Republic of","Tanzania",$ctyisotwo);
$ctyisotwo=str_replace("Iran, Islamic Republic of","Iran",$ctyisotwo);
$ctyisotwo=str_replace("Macedonia, the Former Yugoslav Republic of","Macedonia",$ctyisotwo);
$ctyisotwo=str_replace("Korea (North)","North Korea",$ctyisotwo);
$ctyisotwo=str_replace("Korea (South)","South Korea",$ctyisotwo);
$ctyisotwo=str_replace("Netherlands Antilles","Netherlands",$ctyisotwo);
$ctyisotwo=str_replace("Micronesia, Federated States of", "Micronesia", $ctyisotwo);
$ctyisotwo=str_replace("Micronesia, Federated States Of", "Micronesia", $ctyisotwo);
$ctyisotwo=str_replace("United States Minor Outlying Islands", "United States", $ctyisotwo);
$ctyisotwo=str_replace("Palestinian Territory","Palestine", $ctyisotwo);
$ctyisotwo=str_replace("West Bank","Palestine", $ctyisotwo);
$ctyisotwo=str_replace("Virgin Islands, U.S.","United States", $ctyisotwo);
$ctyisotwo=str_replace("Virgin Islands, British","United Kingdom", $ctyisotwo);
$ctyisotwo=str_replace("Czech Republic", "Czechia", $ctyisotwo);
//
// |
// Afghanistan |
// AF |
// AFG |
// 004 |
//
foreach (glob("*.zip") as $zipfile) {
$zip = zip_open($zipfile);
if ($zip) {
$outxml=" ";
while ($zip_entry = zip_read($zip)) {
$ourfilename=zip_entry_name($zip_entry);
$regexpok=0;
if (strpos($ourfilename, "_MACOSX/") === false) {
//$regexp="/^[\S]" . str_replace('[\s\S]?','[\s\S]*',str_replace('*','[\s\S]?',str_replace('?',',',str_replace('%',',',str_replace('.','[.]',$ofwhat))))) . "$/";
//$regexpok=preg_match($regexp, explode("/",$ourfilename)[-1 + sizeof(explode("/",$ourfilename))]);
$regexpok=1;
if ($regexpok !== 0) {
if ($outxml == " ") { $outxml=""; }
$fchunk=zip_entry_read($zip_entry, zip_entry_filesize($zip_entry));
if (strpos(strtolower($ourfilename), ".xml") !== false && strpos($fchunk, "") !== false && strpos($fchunk, "") !== false) {
//echo strtoupper($ourfilename) . "\n";
$fchunk=data_unify($fchunk);
$bits=explode("", $fchunk);
for ($i=1; $i", $bits[-1 + $i]);
$thosetwobits=explode("<", $thistwobits[-1 + sizeof($thistwobits)]);
$countriesarr[sizeof($countriesarr)]=$thosetwobits[0];
if (strpos($ctyisotwo, ">" . $thosetwobits[0]) !== false) {
$countriesisotwo[sizeof($countriesisotwo)]=getih(trim(explode("<",explode('">', explode(">" . $thosetwobits[0],$ctyisotwo)[1])[1])[0]));
} else {
$countriesisotwo[sizeof($countriesisotwo)]=trim(" ");
}
if (!strstr($uniquecountries, "," . urlencode($thosetwobits[0] . $countriesisotwo[-1 + sizeof($countriesisotwo)] . $preget) . ",") && !strstr($uniquecountries, "," . urlencode($thosetwobits[0] . $countriesisotwo[-1 + sizeof($countriesisotwo)]) . ",")) {
$uniquecountries .= urlencode($thosetwobits[0] . $countriesisotwo[-1 + sizeof($countriesisotwo)] . $preget) . ",";
//echo $thosetwobits[0] . "\n";
}
$countriesarr[-1 + sizeof($countriesarr)].=$countriesisotwo[-1 + sizeof($countriesisotwo)];
$countriesisotwo[-1 + sizeof($countriesisotwo)]='';
//echo "0:" . sizeof($countriesarr) . "\n";
}
} else if (strpos(strtolower($ourfilename), ".csv") !== false) { // thanks to https://simplemaps.com/data/world-cities
// "city","city_ascii","lat","lng","country","iso2","iso3","admin_name","capital","population","id"
// "Tokyo","Tokyo","35.6897","139.6922","Japan","JP","JPN","Tōkyō","primary","37977000","1392685764"
// "Jakarta","Jakarta","-6.2146","106.8451","Indonesia","ID","IDN","Jakarta","primary","34540000","1360771077"
//echo strtolower($ourfilename) . "\n";
$fchunk=data_unify($fchunk);
$bits=explode("\n", $fchunk);
$hbit=str_replace('"','',strtolower($bits[0]));
$hbits=explode(",", $hbit);
$citycol=-1;
$countrycol=-1;
$isocol=-1;
$latcol=-1;
$longcol=-1;
$latis="";
$longis="";
if (strpos(("," . $hbit . ","), ",city") !== false && strpos(("," . $hbit . ","), ",country") !== false && strpos($hbit, ",") !== false) {
for ($i=0; $i=0 && $countrycol >= 0) {
for ($i=1; $i= 0 && $latcol >= 0) {
$latis="|" . str_replace('"','',explode(",",$bits[$i])[$latcol]) . ",";
$longis=str_replace('"','',explode(",",$bits[$i])[$longcol]);
}
if (substr(str_replace('"','',explode(",",$bits[$i])[$countrycol]),0,1) >= "A") {
if (substr($bits[$i],0,1) == '"') {
$citiesarr[sizeof($citiesarr)]=str_replace('"','',explode('","',$bits[$i])[$citycol]) . $latis . $longis;
} else {
$citiesarr[sizeof($citiesarr)]=explode(",",$bits[$i])[$citycol] . $latis . $longis;
}
if (substr($bits[$i],0,1) == '"') {
$countriesarr[sizeof($countriesarr)]=str_replace('"','',explode(",",$bits[$i])[$countrycol]);
} else {
$countriesarr[sizeof($countriesarr)]=explode(",",$bits[$i])[$countrycol];
}
if ($isocol >= 0) {
if (substr($bits[$i],0,1) == '"') {
$countriesisotwo[sizeof($countriesisotwo)]=getih(str_replace('"','',explode(",",$bits[$i])[$isocol]));
} else {
$countriesisotwo[sizeof($countriesisotwo)]=getih(explode(",",$bits[$i])[$isocol]);
}
} else {
$countriesisotwo[sizeof($countriesisotwo)]=trim(" ");
}
if (!strstr($uniquecountries, "," . urlencode(str_replace('"','',explode(",",$bits[$i])[$countrycol]) . $countriesisotwo[-1 + sizeof($countriesisotwo)] . $preget) . ",") && !strstr($uniquecountries, "," . urlencode(str_replace('"','',explode(",",$bits[$i])[$countrycol]) . $countriesisotwo[-1 + sizeof($countriesisotwo)]) . ",")) {
$uniquecountries .= urlencode(str_replace('"','',explode(",",$bits[$i])[$countrycol]) . $countriesisotwo[-1 + sizeof($countriesisotwo)] . $preget) . ",";
//echo str_replace('"','',explode(",",$bits[$i])[$countrycol]) . "\n";
}
$countriesarr[-1 + sizeof($countriesarr)].=$countriesisotwo[-1 + sizeof($countriesisotwo)];
$countriesisotwo[-1 + sizeof($countriesisotwo)]='';
}
}
}
}
}
//$outxml.=$outd . $ourfilename . "@!@!@" . str_replace("'", "' + String.fromCharCode(39) + '", str_replace( "\r", " ", str_replace("\n"," ",str_replace('<','<',str_replace('>','>',$isc)))));
//$outxml.=$outd . $ourfilename . "@!@!@" . $fchunk;
//$outd="!@!@!";
}
}
}
zip_close($zip);
$zip=null;
}
//echo "1:" . sizeof($countriesarr) . "\n";
}
//echo "\n finished\n";
if (1 == 2) {
foreach (glob("*cities*.xml") as $filename) {
$fchunk=file_get_contents($filename);
$fchunk=data_unify($fchunk);
$bits=explode("", $fchunk);
for ($i=1; $i", $bits[-1 + $i]);
$thosetwobits=explode("<", $thistwobits[-1 + sizeof($thistwobits)]);
$countriesarr[sizeof($countriesarr)]=$thosetwobits[0];
if (strpos($ctyisotwo, ">" . $thosetwobits[0]) !== false) {
$countriesisotwo[sizeof($countriesisotwo)]=getih(trim(explode("<",explode('">', explode(">" . $thosetwobits[0],$ctyisotwo)[1])[1])[0]));
} else {
$countriesisotwo[sizeof($countriesisotwo)]=trim(" ");
}
if (!strstr($uniquecountries, "," . urlencode($thosetwobits[0] . $countriesisotwo[-1 + sizeof($countriesisotwo)] . $preget) . ",") && !strstr($uniquecountries, "," . urlencode($thosetwobits[0] . $countriesisotwo[-1 + sizeof($countriesisotwo)]) . ",")) {
$uniquecountries .= urlencode($thosetwobits[0] . $countriesisotwo[-1 + sizeof($countriesisotwo)] . $preget) . ",";
}
$countriesarr[-1 + sizeof($countriesarr)].=$countriesisotwo[-1 + sizeof($countriesisotwo)];
$countriesisotwo[-1 + sizeof($countriesisotwo)]='';
}
}
$caplist=file_get_contents("http://www.rjmprogramming.com.au/PHP/country_capital_quiz.php");
// countries.push("Afghanistan"); countryids.push("Afghanistan"); capitals.push("Kabul"); num++;
// countries.push("Albania"); countryids.push("Albania"); capitals.push("Tirana"); num++;
$caplist=data_unify($caplist);
$clarr=explode('countries.push("', $caplist);
for ($ihg=1; $ihg" . explode('"', $clarr[$ihg])[0]) !== false) {
$countriesisotwo[sizeof($countriesisotwo)]=getih(trim(explode("<",explode('">', explode(">" . explode('"', $clarr[$ihg])[0],$ctyisotwo)[1])[1])[0]));
} else {
$countriesisotwo[sizeof($countriesisotwo)]=trim(" ");
}
if (!strstr($uniquecountries, "," . urlencode(explode('"', $clarr[$ihg])[0] . $countriesisotwo[-1 + sizeof($countriesisotwo)] . $preget) . ",") && !strstr($uniquecountries, "," . urlencode(explode('"', $clarr[$ihg])[0] . $countriesisotwo[-1 + sizeof($countriesisotwo)]) . ",")) {
$uniquecountries .= urlencode(explode('"', $clarr[$ihg])[0] . $countriesisotwo[-1 + sizeof($countriesisotwo)] . $preget) . ",";
}
$countriesarr[-1 + sizeof($countriesarr)].=$countriesisotwo[-1 + sizeof($countriesisotwo)];
$countriesisotwo[-1 + sizeof($countriesisotwo)]='';
$citiesarr[sizeof($citiesarr)]=explode('"', explode('capitals.push("', $clarr[$ihg])[1])[0];
}
}
//echo "\n really finished\n";
function cmp($a, $b) { // alphabetical comparison method
$ta=explode("title=", $a);
$tb=explode("title=", $b);
if ($ta[sizeof($ta) - 1] == $tb[sizeof($tb) - 1]) {
return 0;
}
return ($ta[sizeof($ta) - 1] < $tb[sizeof($tb) - 1]) ? -1 : 1;
}
function showucountries() {
global $uniquecountries, $preget;
$lastonewas='youllneverfindthis';
$ret="";
$ucountriesarr=explode(",", $uniquecountries);
usort($ucountriesarr, "cmp");
for ($i=0; $i", "", $ret);
}
}
}
return $ret;
}
function notshowucities() {
global $citiesarr, $countriesarr, $alturlis;
$thisurlis="";
$ret="";
//echo "" . sizeof($countriesarr) . "\n";
$zerois=0;
$oneinc=1;
$ii=0;
if (sizeof($countriesarr) > 1000) { $oneinc=floor(sizeof($countriesarr) / 1000); $zerois=rand(0,994); }
for ($i=$zerois; $i", "", $ret);
} else {
$ret=str_replace("", "", $ret);
}
$ii++;
}
return $ret;
}
function shownextcity() {
global $citiesarr, $countriesarr, $egoes, $escore, $emdef;
$ret="\n var firstd=true, completefinding='', kbsofar='', notc=''; \n var urlprefix='//www.google.com.au/search?tbm=isch&q='; \n var emdef='" . $emdef . "'; \n var firstgo=true; \n var goes=" . explode(" ", $egoes)[0] . "; \n var score=" . $escore . "; \n var lcity=''; \n var oucity=null; var numc=" . sizeof($citiesarr) . ";\n var ans=false; var lastg=-1;\n var ccountry=''; \n
function askemail() {
if (document.getElementById('emailto').value.indexOf('@') == -1) {
var emis=prompt('Please enter Email To address?',emdef);
if (emis) {
if (emis.indexOf('@') != -1) {
document.getElementById('emailto').value=emis;
}
}
}
if (document.getElementById('emailto').value.indexOf('@') != -1) {
document.getElementById('htmlis').value=document.getElementById('htmlis').value.replace(' value=\" \"', ' value=\"' + emis + '\"');
document.getElementById('contact').click();
}
}
function woit(incity) {
window.open(urlprefix + encodeURIComponent(incity), '_blank', 'top=50,left=50,width=400,height=400');
}
function gethtmlready(incval) {
var huhsel='')[0] + '>';
document.getElementById('htmlis').value='City Guess Country Game
Which Country is City In?
' + document.getElementById('cgcform').outerHTML.replace(' action=\"//',' action=\"https://').replace(' value=\"\"',' value=\"' + incval + '\"').replace(huhsel + '','').replace(huhsel,'').replace('display:none','display:inline-block').replace('>','>') + '';
}
function picked(gcountry, gcselo) {
gcselo.setAttribute('data-topiso', '' + gcselo.options[gcselo.selectedIndex].getAttribute('data-iso'));
notc=' (not ' + gcountry + ')';
if (document.getElementById('bemail')) {
document.getElementById('bemail').style.display='inline-block';
}
goes++;
if (gcountry == ccountry) {
score++; document.getElementById('score').innerHTML='Score: ' + score + ' Goes: ' + goes + ' ';
notc='';
document.getElementById('ucountry').title=document.getElementById('ucountry').title.split(' ... ')[0];
if (firstgo) { ans=confirm('Well done. OK does a Google (image) search.');
}
} else {
document.getElementById('score').innerHTML='Score: ' + score + ' Goes: ' + goes + ' ';
ans=confirm('Sorry, but answer is ' + ccountry + notc + '. OK does a Google (image) search.');
notc='';
document.getElementById('ucountry').title=document.getElementById('ucountry').title.split(' ... ')[0];
}
firstgo=false;
if (ans == true) {
window.open(urlprefix + encodeURIComponent(lcity), '_blank', 'top=50,left=50,width=400,height=400');
}
document.getElementById('ucountry').value='';
document.getElementById('oneopt').innerHTML='Please select Country ...';
kbsofar='';
if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
if (firstd && document.getElementById('mydetails')) { document.getElementById('mydetails').removeAttribute('open'); document.getElementById('mydetails').open=false; }
}
firstd=false;
document.getElementById('thcity').innerHTML='City';
getnext();
} \n
function getnext() {
if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
document.getElementById('ucountry').style.fontSize='24px';
}
if (document.getElementById('bemail')) {
document.getElementById('bemail').style.display='inline-block';
}
if (!oucity) {
oucity=document.getElementById('ucity');
}
var rnum=lastg;
while (rnum == lastg) {
rnum=Math.floor(Math.random() * numc);
if (!document.getElementById('o' + rnum)) { rnum=lastg; }
} \n
lastg=rnum;
var ois=document.getElementById('o' + rnum); \n
document.getElementById('ucity').value=ois.value; \n
lcity=ois.value; \n
document.getElementById('thcountry').innerHTML='Country';
document.getElementById('thiscity').value=ois.value;
document.getElementById('thiscity').title=ois.value;
document.getElementById('thcity').innerHTML='City
' + ois.value + '';
ccountry=ois.innerHTML;
if (('' + ois.getAttribute('data-hinturl')).replace(/^null$/g,'').replace(/\+/g,' ') != '') {
document.getElementById('dhint').innerHTML=' ❓';
} else {
document.getElementById('dhint').innerHTML='';
}
gethtmlready(ois.value); \n
} \n
function iframehint(oisgetAttributedatahinturl) {
document.getElementById('dhint').innerHTML='';
} \n
function dodecide() {
if (completefinding.trim() != '') {
document.getElementById('ucountry').value=completefinding;
notc=' (not ' + completefinding + ')';
picked(document.getElementById('ucountry').value, document.getElementById('ucountry'));
kbsofar='';
completefinding='';
// if (document.getElementById('mydetails')) { alert(1); document.getElementById('mydetails').removeAttribute('open'); document.getElementById('mydetails').open=false; }
// location.href='#cgcform';
}
} \n
function crokp(event) {
if (event.keyCode == 13) {
if (completefinding.trim() != '') {
document.getElementById('ucountry').value=completefinding;
notc=' (not ' + completefinding + ')';
picked(document.getElementById('ucountry').value, document.getElementById('ucountry'));
kbsofar='';
completefinding='';
// if (document.getElementById('mydetails')) { alert(11); document.getElementById('mydetails').removeAttribute('open'); document.getElementById('mydetails').open=false; }
// location.href='#cgcform';
} else if (document.getElementById('bemail')) {
document.getElementById('bemail').click();
}
}
} \n
function okp(event) {
var optl=[], joptl=0, jdone=false, findings='', findingsd='', lendiff='', lendiffd='', pfix='', ppfix='', ppdo=true;
completefinding='';
if (event.keyCode == 63) {
if (document.getElementById('hinta')) {
document.getElementById('hinta').click();
}
} else if (event.keyCode >= 65 && event.keyCode <= 90) {
kbsofar+=String.fromCharCode(event.keyCode);
if ((kbsofar + ' ').toLowerCase().substring(0,2) == 'ko' && (kbsofar + ' ').toLowerCase().substring(0,3) != 'kos') { pfix='korea'; if (kbsofar.toLowerCase().replace('n','d').indexOf('d') != -1) { pfix='north korea'; kbsofar=pfix; } else if (kbsofar.toLowerCase().replace('s','r').replace('kor','ko').replace('t','r').indexOf('r') != -1) { pfix='south korea'; kbsofar=pfix; } }
if ((kbsofar + ' ').toLowerCase().substring(0,3) == 'con') { pfix='congo'; if (kbsofar.toLowerCase().indexOf('d') != -1) { pfix='democratic republic of the congo'; } else if (kbsofar.toLowerCase().replace('kor','ko').replace('t','r').indexOf('r') != -1) { pfix='the republic of the congo'; } }
//document.title=kbsofar;
if (kbsofar.length == 2 && kbsofar == kbsofar.toUpperCase()) {
optl=document.getElementsByTagName('option');
for (joptl=1; joptl= 0) { ppfix=pfix; if (pfix != 'congo' && pfix != 'korea') { kbsofar=pfix; } } else { ppfix=''; } }
if (optl[joptl].value != '' && (ppfix + optl[joptl].innerHTML.toLowerCase()).indexOf(kbsofar.toLowerCase()) == 0 && ('' + optl[joptl].outerHTML).indexOf(' data-iso') != -1) {
if (pfix.toLowerCase().indexOf(' congo') != -1 || pfix.toLowerCase().indexOf(' korea') != -1) {
if (completefinding == '') {
completefinding=optl[joptl].value;
} else {
completefinding=' ';
}
} else {
lendiff+=lendiffd + eval(eval('' + optl[joptl].value.length) - eval('' + kbsofar.length));
lendiffd=',';
if (eval(eval('' + optl[joptl].value.length) - eval('' + kbsofar.length)) <= 4) {
if (completefinding == '') {
completefinding=optl[joptl].value;
} else {
completefinding=' ';
}
}
}
findings+=findingsd + optl[joptl].value;
findingsd=',';
}
}
if (findings == '') {
document.getElementById('oneopt').innerHTML='Please select Country ...';
document.getElementById('thcountry').innerHTML='Country';
kbsofar='';
} else if (findings.indexOf(',') != -1) {
document.getElementById('oneopt').innerHTML=findings;
document.getElementById('ucountry').title=document.getElementById('ucountry').title.split(' ... ')[0] + ' ... ' + findings;
document.getElementById('thcountry').innerHTML='Country
' + findings + '';
//document.title=lendiff + ' .... ' + completefinding;
if (completefinding.trim() != '') {
setTimeout(dodecide,2000);
}
} else {
document.getElementById('ucountry').value=findings;
notc=' (not ' + findings + ')';
picked(document.getElementById('ucountry').value, document.getElementById('ucountry'));
kbsofar='';
// if (document.getElementById('mydetails')) { alert(111); document.getElementById('mydetails').removeAttribute('open'); document.getElementById('mydetails').open=false; }
// location.href='#cgcform';
}
}
} else if ((event.keyCode >= 97 && event.keyCode <= 122) || event.keyCode == 32) {
kbsofar+=String.fromCharCode(event.keyCode);
if ((kbsofar + ' ').toLowerCase().substring(0,2) == 'ko' && (kbsofar + ' ').toLowerCase().substring(0,3) != 'kos') { pfix='korea'; if (kbsofar.toLowerCase().replace('n','d').indexOf('d') != -1) { pfix='north korea'; kbsofar=pfix; } else if (kbsofar.toLowerCase().replace('s','r').replace('kor','ko').replace('t','r').indexOf('r') != -1) { pfix='south korea'; kbsofar=pfix; } }
if ((kbsofar + ' ').toLowerCase().substring(0,3) == 'con') { pfix='congo'; if (kbsofar.toLowerCase().indexOf('d') != -1) { pfix='democratic republic of the congo'; kbsofar=pfix; } else if (kbsofar.toLowerCase().replace('kor','ko').replace('t','r').indexOf('r') != -1) { pfix='the republic of the congo'; kbsofar=pfix; } }
optl=document.getElementsByTagName('option');
for (joptl=1; joptl= 0) { ppfix=pfix; if (pfix != 'congo' && pfix != 'korea') { kbsofar=pfix; } } else { ppfix=''; } }
if (optl[joptl].value != '' && (ppfix + optl[joptl].innerHTML.toLowerCase()).indexOf(kbsofar.toLowerCase()) == 0 && ('' + optl[joptl].outerHTML).indexOf(' data-iso=') != -1) {
if (pfix.toLowerCase().indexOf(' congo') != -1 || pfix.toLowerCase().indexOf(' korea') != -1) {
if (completefinding == '') {
completefinding=optl[joptl].value;
} else {
completefinding=' ';
}
} else {
lendiff+=lendiffd + eval(eval('' + optl[joptl].value.length) - eval('' + kbsofar.length));
lendiffd=',';
if (eval(eval('' + optl[joptl].value.length) - eval('' + kbsofar.length)) <= 4) {
if (completefinding == '') {
completefinding=optl[joptl].value;
} else {
completefinding=' ';
}
}
}
findings+=findingsd + optl[joptl].value;
findingsd=',';
}
}
if (findings == '') {
document.getElementById('oneopt').innerHTML='Please select Country ...';
document.getElementById('thcountry').innerHTML='Country';
kbsofar='';
} else if (findings.indexOf(',') != -1) {
document.getElementById('oneopt').innerHTML=findings;
document.getElementById('ucountry').title=document.getElementById('ucountry').title.split(' ... ')[0] + ' ... ' + findings;
document.getElementById('thcountry').innerHTML='Country
' + findings + '';
//document.title=lendiff + ' ... ' + completefinding;
if (completefinding.trim() != '') {
setTimeout(dodecide,2000);
}
} else {
document.getElementById('ucountry').value=findings;
notc=' (not ' + findings + ')';
picked(document.getElementById('ucountry').value, document.getElementById('ucountry'));
kbsofar='';
// if (document.getElementById('mydetails')) { alert(1111); document.getElementById('mydetails').removeAttribute('open'); document.getElementById('mydetails').open=false; }
// location.href='#cgcform';
}
}
return false;
}
";
return $ret;
}
echo "City Guess Country Game" . shownextcity() . "
" . $dsprefix . "City Guess Country Game
Which Country is City In?
" . $dssuffix . "
Score: " . $escore . " Goes: " . $egoes . "
";
?>