avm99963 | f0d1521 | 2017-10-08 17:03:22 +0200 | [diff] [blame] | 1 | <?php |
avm99963 | 658fae5 | 2017-10-08 23:09:16 +0200 | [diff] [blame] | 2 | require_once("config.php"); |
| 3 | |
avm99963 | f0d1521 | 2017-10-08 17:03:22 +0200 | [diff] [blame] | 4 | class write { |
Huguet57 | e9f4765 | 2018-07-23 03:28:12 +0200 | [diff] [blame] | 5 | public static function funct($json) { |
avm99963 | f0d1521 | 2017-10-08 17:03:22 +0200 | [diff] [blame] | 6 | print_r(json_encode($json)); |
| 7 | exit(); |
| 8 | } |
| 9 | |
| 10 | public static function error($n, $msg) { |
Huguet57 | e9f4765 | 2018-07-23 03:28:12 +0200 | [diff] [blame] | 11 | self::funct(["error" => $n, "msg" => $msg]); |
avm99963 | f0d1521 | 2017-10-08 17:03:22 +0200 | [diff] [blame] | 12 | } |
| 13 | } |
| 14 | |
| 15 | if (!isset($_GET["action"])) { |
| 16 | write::error(1, "No action provided"); |
| 17 | } |
| 18 | |
| 19 | switch ($_GET["action"]) { |
| 20 | case "getgraf": |
Huguet57 | b03dfc8 | 2018-07-23 01:24:45 +0200 | [diff] [blame] | 21 | $graf = file_get_contents("https://grafo.dirba.io/api.php?req=getGraph"); |
avm99963 | f0d1521 | 2017-10-08 17:03:22 +0200 | [diff] [blame] | 22 | echo $graf; |
| 23 | break; |
| 24 | |
| 25 | default: |
| 26 | write::error(2, "Unknown action"); |
| 27 | } |
| 28 | ?> |