check.php 749 B

123456789101112131415161718192021222324252627
  1. <?php
  2. include_once("../auth.php");
  3. if (isset($_GET['rid'])){
  4. touch("data/" . $_GET['rid'] . ".alive");
  5. $alives = scandir("data/");
  6. foreach($alives as $file){
  7. $time = filectime("data/".$file);
  8. if($time + 30 <= time() && $file !== ".." && $file !== "."){
  9. unlink("data/".$file);
  10. }
  11. }
  12. if (file_exists("data/" . $_GET['rid'] . ".inf")){
  13. $data = file_get_contents("data/" . $_GET['rid'] . ".inf");
  14. $data = explode(",",$data);
  15. header('Content-Type: application/json');
  16. echo json_encode([true,$data]);
  17. unlink("data/" . $_GET['rid'] . ".inf");
  18. }else{
  19. header('Content-Type: application/json');
  20. echo json_encode([false,""]);
  21. }
  22. }else{
  23. echo "ERROR. rid not given.";
  24. }
  25. ?>