$minlat=0; $minlong=0; $maxlat=0; $maxlong=0; $cstuff=''; $delim=''; $valafters=''; $bigxy=file_get_contents('./countries.html'); $smallxy=file_get_contents('./image_chart.php'); $recs=explode(' data-iso2="' . $_GET['ccode'] . '"', $bigxy); $records=explode(',' . $_GET['ccode'] . ',', $smallxy); if (sizeof($recs) > 1 && sizeof($records) > 1) { $valafters=explode(' value=', $records[0])[-1 + sizeof(explode(' value=', $records[0]))]; for ($ii=1; $ii 1) { $minlat=$ccs[1]; $minlong=$ccs[0]; $maxlat=$ccs[1]; $maxlong=$ccs[0]; for ($ij=2; $ij $ccs[1 + $ij]) { $minlat=$ccs[1 + $ij]; } if ($maxlat < $ccs[1 + $ij]) { $maxlat=$ccs[1 + $ij]; } if ($minlong > $ccs[0 + $ij]) { $minlong=$ccs[0 + $ij]; } if ($maxlong < $ccs[0 + $ij]) { $maxlong=$ccs[0 + $ij]; } } $from=$valafters . ',' . $_GET['ccode'] . ','; if (strpos($from, ' title=') === false && strpos($from, ' data-geo=') !== false) { $to=str_replace(' data-geo=', ' title=' . "\\\"" . str_replace(' ','',('' . $minlat . ',' . $minlong . ',' . $maxlat . ',' . $maxlong)) . "\\\" data-geo=", $from); // ... ' . $valafters; file_put_contents('./image_chart.php', str_replace($from, $to, $smallxy)); echo $to; } } } ?>