Some small changes to make it work with mysql
This commit is contained in:
parent
97781a229b
commit
51f0c78102
|
@ -2,9 +2,9 @@
|
|||
|
||||
// !!! SET YOUR SQL-CONNECTION SETTINGS HERE: !!!
|
||||
|
||||
$driver = 'mysql'; //PDO driver name, check the PDO documentation for available drivers at https://www.php.net/manual/en/pdo.drivers.php. Common ones are 'pgsql' or 'mysql'.
|
||||
$driver = 'mysql'; // 'mysql' (MySQL) or 'pgsql' (PostgreSQL)
|
||||
$hostname = '127.0.0.1';
|
||||
$port = 3306; // Remember to change this value to match your database configuration
|
||||
$port = 3306;
|
||||
$username = 'root';
|
||||
$password = '';
|
||||
$database = 'bluemap';
|
||||
|
@ -16,6 +16,11 @@ $hiresCompression = 'gzip';
|
|||
// !!! END - DONT CHANGE ANYTHING AFTER THIS LINE !!!
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
// some helper functions
|
||||
function error($code, $message = null) {
|
||||
global $path;
|
||||
|
@ -84,6 +89,14 @@ function getMimeType($path) {
|
|||
return $mimeDefault;
|
||||
}
|
||||
|
||||
function send($data) {
|
||||
if (is_resource($data)) {
|
||||
fpassthru($data);
|
||||
} else {
|
||||
echo $data;
|
||||
}
|
||||
}
|
||||
|
||||
// determine relative request-path
|
||||
$root = dirname($_SERVER['PHP_SELF']);
|
||||
if ($root === "/" || $root === "\\") $root = "";
|
||||
|
@ -159,7 +172,7 @@ if (startsWith($path, "/maps/")) {
|
|||
} else {
|
||||
header("Content-Type: image/png");
|
||||
}
|
||||
fpassthru($line["data"]);
|
||||
send($line["data"]);
|
||||
exit;
|
||||
}
|
||||
|
||||
|
@ -187,9 +200,9 @@ if (startsWith($path, "/maps/")) {
|
|||
$statement->execute();
|
||||
|
||||
if ($line = $statement->fetch()) {
|
||||
header("Content-Type: ".getMimeType($mapPath));
|
||||
fpassthru($line["value"]);
|
||||
exit;
|
||||
header("Content-Type: ".getMimeType($mapPath));
|
||||
send($line["value"]);
|
||||
exit;
|
||||
}
|
||||
} catch (PDOException $e) { error(500, "Failed to fetch data"); }
|
||||
|
||||
|
|
Loading…
Reference in New Issue