diff --git a/website/download.php b/website/download.php index 5c25486d..f56ef18b 100644 --- a/website/download.php +++ b/website/download.php @@ -5,23 +5,25 @@ $mgk = $_GET["mgk"]; if (($pkg != "") && ($ver != "") && ($mgk == "18966")) { - $filename = "/var/www/pkg_stats/" . $pkg . "-" . $ver . ".cnt"; - $cnt = 0; - if (file_exists($filename)){ - $cnt = intval(file_get_contents($filename)); - } - else { - touch($filename); - chmod($filename, 0777); - } - $cnt = $cnt + 1; + if ((is_dir("/var/www/pkgr.art/public/" . $pkg)) && + (is_dir("/var/www/pkgr.art/public/" . $pkg . "/" . $ver))) { + $filename = "/var/www/pkg_stats/" . $pkg . "-" . $ver . ".cnt"; + $cnt = 0; + if (file_exists($filename)){ + $cnt = intval(file_get_contents($filename)); + } + else { + touch($filename); + chmod($filename, 0777); + } + $cnt = $cnt + 1; - $openFile = fopen($filename, "w+") or die("Can't open file"); - fwrite($openFile, strval($cnt)); - fclose($openFile); - fclose($myfile); + $openFile = fopen($filename, "w+") or die("Can't open file"); + fwrite($openFile, strval($cnt)); + fclose($openFile); - echo $cnt; + echo $cnt; + } } ?> \ No newline at end of file