6c6
< set_time_limit(200);
---
> set_time_limit(200);
8,71c8
< $dsprefix="
";
< $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="";
<
< 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("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;
< }
---
> $preget="";
76,78d12
< if ($indefe == "XW") { $indefe="PS"; }
< if ($indefe == "AN") { $indefe="NL"; }
< if ($indefe == "Federated States Of") { $indefe="FM"; }
137,144d70
< $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);
170d95
< $fchunk=data_unify($fchunk);
183c108
< if (!strstr($uniquecountries, "," . urlencode($thosetwobits[0] . $countriesisotwo[-1 + sizeof($countriesisotwo)] . $preget) . ",") && !strstr($uniquecountries, "," . urlencode($thosetwobits[0] . $countriesisotwo[-1 + sizeof($countriesisotwo)]) . ",")) {
---
> if (!strstr($uniquecountries, "," . urlencode($thosetwobits[0] . $countriesisotwo[-1 + sizeof($countriesisotwo)] . $preget) . ",")) {
199d123
< $fchunk=data_unify($fchunk);
238c162
< 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)]) . ",")) {
---
> if (!strstr($uniquecountries, "," . urlencode(str_replace('"','',explode(",",$bits[$i])[$countrycol]) . $countriesisotwo[-1 + sizeof($countriesisotwo)] . $preget) . ",")) {
268d191
< $fchunk=data_unify($fchunk);
281c204
< if (!strstr($uniquecountries, "," . urlencode($thosetwobits[0] . $countriesisotwo[-1 + sizeof($countriesisotwo)] . $preget) . ",") && !strstr($uniquecountries, "," . urlencode($thosetwobits[0] . $countriesisotwo[-1 + sizeof($countriesisotwo)]) . ",")) {
---
> if (!strstr($uniquecountries, "," . urlencode($thosetwobits[0] . $countriesisotwo[-1 + sizeof($countriesisotwo)] . $preget) . ",")) {
294d216
< $caplist=data_unify($caplist);
306c228
< if (!strstr($uniquecountries, "," . urlencode(explode('"', $clarr[$ihg])[0] . $countriesisotwo[-1 + sizeof($countriesisotwo)] . $preget) . ",") && !strstr($uniquecountries, "," . urlencode(explode('"', $clarr[$ihg])[0] . $countriesisotwo[-1 + sizeof($countriesisotwo)]) . ",")) {
---
> if (!strstr($uniquecountries, "," . urlencode(explode('"', $clarr[$ihg])[0] . $countriesisotwo[-1 + sizeof($countriesisotwo)] . $preget) . ",")) {
330d251
< $lastonewas='youllneverfindthis';
335,344c256
< if (strlen($ucountriesarr[$i]) != 0) {
< $preget="";
< if (strpos(urldecode($ucountriesarr[$i]), "|") !== false) {
< $preget=explode("|", urldecode($ucountriesarr[$i]))[1];
< }
< if (strpos($lastonewas, explode("|",urldecode($ucountriesarr[$i]))[0]) === false) {
< $lastonewas=explode("|",urldecode($ucountriesarr[$i]))[0];
< $ret=str_replace("", "", $ret);
< }
< }
---
> if (strlen($ucountriesarr[$i]) != 0) { $preget=""; if (strpos(urldecode($ucountriesarr[$i]), "|") !== false) { $preget=explode("|", urldecode($ucountriesarr[$i]))[1]; } $ret=str_replace("", "", $ret); }
366c278
< $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
---
> $ret="\n var 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
414,418d325
< 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';
422,424d328
< if (navigator.userAgent.match(/Android|BlackBerry|iPhone|iPad|iPod|Opera Mini|IEMobile/i)) {
< document.getElementById('ucountry').style.fontSize='24px';
< }
440d343
< document.getElementById('thcountry').innerHTML='Country';
454d356
< // if (document.getElementById('mydetails')) { alert(1); document.getElementById('mydetails').removeAttribute('open'); document.getElementById('mydetails').open=false; }
466d367
< // if (document.getElementById('mydetails')) { alert(11); document.getElementById('mydetails').removeAttribute('open'); document.getElementById('mydetails').open=false; }
474c375
< var optl=[], joptl=0, jdone=false, findings='', findingsd='', lendiff='', lendiffd='', pfix='', ppfix='';
---
> var optl=[], joptl=0, jdone=false, findings='', findingsd='', lendiff='', lendiffd='';
478,479d378
< 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'; } }
494,495d392
< 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; } }
498,506c395
< if (pfix != '' && optl[joptl].value.toLowerCase().indexOf('hong kong') == -1) { if (('' + optl[joptl].innerHTML.toLowerCase()).indexOf(kbsofar.toLowerCase()) >= 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 {
---
> if (optl[joptl].value != '' && ('' + optl[joptl].innerHTML.toLowerCase()).indexOf(kbsofar.toLowerCase()) == 0 && ('' + optl[joptl].outerHTML).indexOf(' data-') != -1) {
516d404
< }
527d414
< document.getElementById('thcountry').innerHTML='Country
' + findings + '';
537d423
< // if (document.getElementById('mydetails')) { alert(111); document.getElementById('mydetails').removeAttribute('open'); document.getElementById('mydetails').open=false; }
543,544d428
< 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; } }
547,555c431
< if (pfix != '' && optl[joptl].value.toLowerCase().indexOf('hong kong') == -1) { if (('' + optl[joptl].innerHTML.toLowerCase()).indexOf(kbsofar.toLowerCase()) >= 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-') != -1) {
< if (pfix.toLowerCase().indexOf(' congo') != -1 || pfix.toLowerCase().indexOf(' korea') != -1) {
< if (completefinding == '') {
< completefinding=optl[joptl].value;
< } else {
< completefinding=' ';
< }
< } else {
---
> if (optl[joptl].value != '' && ('' + optl[joptl].innerHTML.toLowerCase()).indexOf(kbsofar.toLowerCase()) == 0 && ('' + optl[joptl].outerHTML).indexOf(' data-') != -1) {
565d440
< }
576d450
< document.getElementById('thcountry').innerHTML='Country
' + findings + '';
586d459
< // if (document.getElementById('mydetails')) { alert(1111); document.getElementById('mydetails').removeAttribute('open'); document.getElementById('mydetails').open=false; }
597,598c470,471
< " . $dsprefix . "City Guess Country Game
< Which Country is City In?
" . $dssuffix . "
---
> City Guess Country Game
> Which Country is City In?
607c480
< " . notshowucities() . "" . notshowucities() . "