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']; //Victor says not needed if we have awstats statistics per file //if(!isset($_SERVER['HTTP_RANGE']) ) { // update_count_of_downloads($file) ; //} set_time_limit(0); if(isset($_GET['direct']) 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); } ?>