rc3/maps/ir/cellar/01/room.php

20 lines
548 B
PHP
Raw Normal View History

2021-02-15 19:14:50 +00:00
<?php
# Load state and test switch
$state = json_decode(file_get_contents("state.json"), true);
2021-02-16 03:51:02 +00:00
$switch = $state["switch_open"];
2021-02-15 19:14:50 +00:00
# Load open/closed level depending on switch
2021-02-16 03:51:02 +00:00
$data = file_get_contents( $switch ? "room_open.json" : "room_closed.json");
2021-02-15 19:14:50 +00:00
2021-02-16 03:22:04 +00:00
// Patch php filenames with timestamps to defeat cache
// destination.php --> destination.number.php
$tstamp = round(microtime(true)*100); # 0.01 sec resolution
$data = str_replace(".php", ".".$tstamp.".php", $data);
2021-02-15 19:14:50 +00:00
header('Content-type: application/json');
echo($data);
exit;
?>