xpath('//download[@name="'.$file.'"]'); if (count($res) > 0) { $node = $res[0]; $node["count"] = intval($node["count"]) + 1; } else { $obj = $xml-> addChild("download"); $obj -> addAttribute("name", $file); $obj -> addAttribute("count", "1"); } $xml->asXML("download_stat.xml"); //fclose($xml); } catch(Exception $e) { } } if(!isset($_GET['file']) ) { header('HTTP/1.0 404 Not Found'); die(1); } $file = $_GET['file']; // not used now //if(!isset($_SERVER['HTTP_RANGE']) ) { // update_count_of_downloads($file) ; //} set_time_limit(0); $xml = simplexml_load_file("indexes.xml"); $res = $xml->xpath('//region[@name="'.$file.'"]'); if (count($res) > 0) { $node = $res[0]; if($node["local"]) { downloadFile('indexes/'.$file); } else { header('HTTP/1.1 302 Found'); header('Location: http://osmand.googlecode.com/files/'.$file); } } else { header('HTTP/1.1 302 Found'); header('Location: http://osmand.googlecode.com/files/'.$file); } ?>