opr.php 633 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. if (isset($_GET['opr'])){
  3. if($_GET["opr"] == "scanalive"){
  4. $output = [];
  5. $file = glob('data/*.alive');
  6. foreach($file as $alive){
  7. array_push($output,basename($alive,".alive"));
  8. }
  9. echo json_encode($output);
  10. }else if($_GET["opr"] == "mime"){
  11. $file = $_GET["file"];
  12. if (!file_exists($_GET["file"])){
  13. //Check if it is a path with extDiskAccess.php
  14. if (strpos($_GET["file"],"extDiskAccess.php?file=") !== false){
  15. $file = array_pop(explode("=",$_GET['file']));
  16. }
  17. }
  18. echo explode("/",mime_content_type($file))[0];
  19. }else{
  20. echo "[]";
  21. }
  22. }else{
  23. echo "[]";
  24. }