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) { } } $file = $_GET['file']; $direct = $_GET['direct']; if(!isset($_SERVER['HTTP_RANGE']) ) { update_count_of_downloads($file) ; } set_time_limit(0); if($direct == 'yes' or !url_exists('http://osmand.googlecode.com/files/'.$file)) { downloadFile('indexes/'.$file); } else { header('HTTP/1.1 302 Found'); header('Location: http://osmand.googlecode.com/files/'.$file); } ?>