home - projects - login - links

Project: CodeBase

Location: root /

File: project_download.php

expand uitklappen
  1. <?php
  2. require_once ("includes/database.php");
  3. require_once ("includes/project.php");
  4.  
  5. die ("Coming soonish.");
  6.  
  7. $project_id = (int) $_GET['project'];
  8. $act = addslashes(htmlspecialchars($_GET['act']));
  9. $type = addslashes(htmlspecialchars($_GET['type']));
  10. if ($act == "code" || $act == "screenshots" || $act == "documentation") {
  11. // valid
  12. } else {
  13. die ("invalid ACT");
  14. }
  15.  
  16. $Project = new Project($project_id);
  17.  
  18. if ($type == "zip") {
  19. // Create a ZIP-file
  20. require_once ("includes/archive/CreateZipFile.php");
  21. $createZip = new CreateZip;
  22. $createZip->addDirectory ("./projects/". $Project->loc ."/". $act );
  23.  
  24. $filename = "source.zip";
  25. $fh = fopen("./archives/". $filename, "wb");
  26. $out = fwrite($fh, $createZip->getZippedFile());
  27. fclose($fh);
  28.  
  29. $createZip -> forceDownload("archives/". $fileName);
  30. @unlink("./archives/". $fileName);
  31. }
  32.  
  33.  
  34.  
  35. ?>