-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathmineloadplugin.php
More file actions
33 lines (32 loc) · 1.01 KB
/
mineloadplugin.php
File metadata and controls
33 lines (32 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
<?php
/* because of 'same origin access control' security reasons the data has to be proxied
* from the bukkit server to the client because of xmlhttp request limitations.
*
*/
include 'config/config.php';
set_error_handler("errorHandler");
$dom = new DOMDocument('1.0', 'UTF-8');
$server = $dom->createElement("server");
$dom->appendChild($server);
session_start();
function errorHandler($code, $message){
global $dom, $server;
$error = $dom->createElement("error");
$error->appendChild($dom->createTextNode($message));
$error->setAttribute("code", $code);
$server->appendChild($error);
}
if (isset($_SESSION['user'])) {
$xmlData = file_get_contents("http://".$_mlp_host.":".$_mlp_port."?password=$_mlp_password");
header('Content-Type: text/xml');
header('Cache-Control: no-cache');
echo $xmlData;
}
else {
//they are not logged in.
$error = $dom->createElement("error");
$error->appendChild($dom->createTextNode("User not authorized."));
$server->appendChild($error);
echo $dom->saveXML();
}
?>