", $fchunk); for ($i=1; $i", $bits[-1 + $i]); $thosetwobits=explode("<", $thistwobits[-1 + sizeof($thistwobits)]); $countriesarr[sizeof($countriesarr)]=$thosetwobits[0]; if (!strstr($uniquecountries, "," . urlencode($thosetwobits[0]) . ",")) { $uniquecountries .= urlencode($thosetwobits[0]) . ","; } } } 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; $ret=""; $ucountriesarr=explode(",", $uniquecountries); usort($ucountriesarr, "cmp"); for ($i=0; $i", "", $ret); } return $ret; } function notshowucities() { global $citiesarr, $countriesarr; $ret=""; for ($i=0; $i", "", $ret); } return $ret; } function shownextcity() { global $citiesarr, $countriesarr; $ret="\n var urlprefix='https://www.google.com.au/search?tbm=isch&q='; \n var firstgo=true; var goes=0; \n var score=0; \n var lcity=''; \n var oucity=null; var numc=" . sizeof($citiesarr) . ";\n var ans=false; var lastg=-1;\n var ccountry=''; \n function picked(gcountry) { goes++; if (gcountry == ccountry) { score++; document.getElementById('score').innerHTML='Score: ' + score + ' Goes: ' + goes; 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 + '. OK does a Google (image) search.'); } firstgo=false; if (ans == true) { window.open(urlprefix + encodeURIComponent(lcity), '_blank', 'top=50,left=50,width=400,height=400'); } document.getElementById('ucountry').value=''; getnext(); } \n function getnext() { if (!oucity) { oucity=document.getElementById('ucity'); } var rnum=lastg; while (rnum == lastg) { rnum=Math.floor(Math.random() * numc); } \n lastg=rnum; var ois=document.getElementById('o' + rnum); \n document.getElementById('ucity').value=ois.value; \n lcity=ois.value; \n document.getElementById('thiscity').value=ois.value; ccountry=ois.innerHTML; \n } \n "; return $ret; } echo "City Guess Country Game" . shownextcity() . "

City Guess Country Game


Which Country is City In?


Score: 0 Goes: 0


" . notshowucities() . "
CityCountry
" . showucountries() . "
"; ?>