<?php
-// Database credentials
-$host = 'localhost';
-$db = 'slayer.unlishema.org';
-$user = 'slayer.db';
-$pass = 'r2YWbde6V9hr';
+// Database credentials with default values
+$host = "localhost";
+$user = "username";
+$pass = "password";
+$db = "database";
+
+// Load database creds so they aren't public
+$configPath = $_SERVER['DOCUMENT_ROOT'] . '/../../slayer_assistant_private.json';
+
+if (file_exists($configPath)) {
+ $config = json_decode(file_get_contents($configPath), true);
+ if ($config === null) {
+ die("Invalid configuration format.");
+ }
+ // Update variables with config values if the file is found
+ $host = $config['host'];
+ $user = $config['username']; // Overrides initial $user = "username"
+ $pass = $config['password'];
+ $db = $config['dbname'];
+} else {
+ die("Configuration file not found.");
+}
// Function to return error as JSON and exit
function respondWithError($message) {
<?php
-// Database credentials
-$host = 'localhost';
-$db = 'slayer.unlishema.org';
-$user = 'slayer.db';
-$pass = 'r2YWbde6V9hr';
+// Database credentials with default values
+$host = "localhost";
+$user = "username";
+$pass = "password";
+$db = "database";
+
+// Load database creds so they aren't public
+$configPath = $_SERVER['DOCUMENT_ROOT'] . '/../../slayer_assistant_private.json';
+
+if (file_exists($configPath)) {
+ $config = json_decode(file_get_contents($configPath), true);
+ if ($config === null) {
+ die("Invalid configuration format.");
+ }
+ // Update variables with config values if the file is found
+ $host = $config['host'];
+ $user = $config['username']; // Overrides initial $user = "username"
+ $pass = $config['password'];
+ $db = $config['dbname'];
+} else {
+ die("Configuration file not found.");
+}
// Function to return error as JSON and exit
function respondWithError($message) {
<?php
-// Database credentials
-$host = 'localhost';
-$db = 'slayer.unlishema.org';
-$user = 'slayer.db';
-$pass = 'r2YWbde6V9hr';
+// Database credentials with default values
+$host = "localhost";
+$user = "username";
+$pass = "password";
+$db = "database";
+
+// Load database creds so they aren't public
+$configPath = $_SERVER['DOCUMENT_ROOT'] . '/../../slayer_assistant_private.json';
+
+if (file_exists($configPath)) {
+ $config = json_decode(file_get_contents($configPath), true);
+ if ($config === null) {
+ die("Invalid configuration format.");
+ }
+ // Update variables with config values if the file is found
+ $host = $config['host'];
+ $user = $config['username']; // Overrides initial $user = "username"
+ $pass = $config['password'];
+ $db = $config['dbname'];
+} else {
+ die("Configuration file not found.");
+}
// Function to return error as JSON and exit
function respondWithError($message) {
<?php
-// Database credentials
-$host = 'localhost';
-$db = 'slayer.unlishema.org';
-$user = 'slayer.db';
-$pass = 'r2YWbde6V9hr';
+// Database credentials with default values
+$host = "localhost";
+$user = "username";
+$pass = "password";
+$db = "database";
+
+// Load database creds so they aren't public
+$configPath = $_SERVER['DOCUMENT_ROOT'] . '/../../slayer_assistant_private.json';
+
+if (file_exists($configPath)) {
+ $config = json_decode(file_get_contents($configPath), true);
+ if ($config === null) {
+ die("Invalid configuration format.");
+ }
+ // Update variables with config values if the file is found
+ $host = $config['host'];
+ $user = $config['username']; // Overrides initial $user = "username"
+ $pass = $config['password'];
+ $db = $config['dbname'];
+} else {
+ die("Configuration file not found.");
+}
// Function to return error as JSON and exit
function respondWithError($message) {
<?php
-// Database credentials
-$host = 'localhost';
-$db = 'slayer.unlishema.org';
-$user = 'slayer.db';
-$pass = 'r2YWbde6V9hr';
+// Database credentials with default values
+$host = "localhost";
+$user = "username";
+$pass = "password";
+$db = "database";
+
+// Load database creds so they aren't public
+$configPath = $_SERVER['DOCUMENT_ROOT'] . '/../../slayer_assistant_private.json';
+
+if (file_exists($configPath)) {
+ $config = json_decode(file_get_contents($configPath), true);
+ if ($config === null) {
+ die("Invalid configuration format.");
+ }
+ // Update variables with config values if the file is found
+ $host = $config['host'];
+ $user = $config['username']; // Overrides initial $user = "username"
+ $pass = $config['password'];
+ $db = $config['dbname'];
+} else {
+ die("Configuration file not found.");
+}
// Function to return error as JSON and exit
function respondWithError($message) {
<?php
-// Database credentials
-$host = 'localhost';
-$db = 'slayer.unlishema.org';
-$user = 'slayer.db';
-$pass = 'r2YWbde6V9hr';
+// Database credentials with default values
+$host = "localhost";
+$user = "username";
+$pass = "password";
+$db = "database";
+
+// Load database creds so they aren't public
+$configPath = $_SERVER['DOCUMENT_ROOT'] . '/../../slayer_assistant_private.json';
+
+if (file_exists($configPath)) {
+ $config = json_decode(file_get_contents($configPath), true);
+ if ($config === null) {
+ die("Invalid configuration format.");
+ }
+ // Update variables with config values if the file is found
+ $host = $config['host'];
+ $user = $config['username']; // Overrides initial $user = "username"
+ $pass = $config['password'];
+ $db = $config['dbname'];
+} else {
+ die("Configuration file not found.");
+}
// Function to return error as JSON and exit
function respondWithError($message) {