|
@@ -1,18 +1,15 @@
|
|
<?php
|
|
<?php
|
|
|
|
|
|
-use DevCoder\DotEnv;
|
|
|
|
use PHPMailer\PHPMailer\Exception;
|
|
use PHPMailer\PHPMailer\Exception;
|
|
use PHPMailer\PHPMailer\PHPMailer;
|
|
use PHPMailer\PHPMailer\PHPMailer;
|
|
|
|
|
|
-require 'dotenv.php';
|
|
|
|
require 'phpmailer/Exception.php';
|
|
require 'phpmailer/Exception.php';
|
|
require 'phpmailer/PHPMailer.php';
|
|
require 'phpmailer/PHPMailer.php';
|
|
require 'phpmailer/SMTP.php';
|
|
require 'phpmailer/SMTP.php';
|
|
|
|
|
|
-(new DotEnv(dirname(__FILE__, 3).'/.env'))->load();
|
|
|
|
-
|
|
|
|
include 'functions.php';
|
|
include 'functions.php';
|
|
|
|
|
|
|
|
+
|
|
if (isset($_POST['checkDB'])) {
|
|
if (isset($_POST['checkDB'])) {
|
|
$values = [
|
|
$values = [
|
|
//SETTINGS::VALUE => REQUEST-VALUE (coming from the html-form)
|
|
//SETTINGS::VALUE => REQUEST-VALUE (coming from the html-form)
|
|
@@ -24,9 +21,11 @@ if (isset($_POST['checkDB'])) {
|
|
'DB_CONNECTION' => 'databasedriver',
|
|
'DB_CONNECTION' => 'databasedriver',
|
|
];
|
|
];
|
|
|
|
|
|
|
|
+ wh_log('Trying to connect to the Database', 'debug');
|
|
|
|
+
|
|
$db = new mysqli($_POST['databasehost'], $_POST['databaseuser'], $_POST['databaseuserpass'], $_POST['database'], $_POST['databaseport']);
|
|
$db = new mysqli($_POST['databasehost'], $_POST['databaseuser'], $_POST['databaseuserpass'], $_POST['database'], $_POST['databaseport']);
|
|
if ($db->connect_error) {
|
|
if ($db->connect_error) {
|
|
- wh_log($db->connect_error);
|
|
|
|
|
|
+ wh_log($db->connect_error, 'error');
|
|
header('LOCATION: index.php?step=2&message=Could not connect to the Database');
|
|
header('LOCATION: index.php?step=2&message=Could not connect to the Database');
|
|
exit();
|
|
exit();
|
|
}
|
|
}
|
|
@@ -36,32 +35,36 @@ if (isset($_POST['checkDB'])) {
|
|
// if ($key == "DB_PASSWORD") {
|
|
// if ($key == "DB_PASSWORD") {
|
|
// $param = '"' . $_POST[$value] . '"';
|
|
// $param = '"' . $_POST[$value] . '"';
|
|
// }
|
|
// }
|
|
- setEnvironmentValue($key, $param);
|
|
|
|
|
|
+ setenv($key, $param);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ wh_log('Database connection successful', 'debug');
|
|
header('LOCATION: index.php?step=2.5');
|
|
header('LOCATION: index.php?step=2.5');
|
|
}
|
|
}
|
|
|
|
|
|
if (isset($_POST['checkGeneral'])) {
|
|
if (isset($_POST['checkGeneral'])) {
|
|
- $appname = '"'.$_POST['name'].'"';
|
|
|
|
|
|
+ wh_log('setting app settings', 'debug');
|
|
|
|
+ $appname = '"' . $_POST['name'] . '"';
|
|
$appurl = $_POST['url'];
|
|
$appurl = $_POST['url'];
|
|
|
|
|
|
if (substr($appurl, -1) === '/') {
|
|
if (substr($appurl, -1) === '/') {
|
|
$appurl = substr_replace($appurl, '', -1);
|
|
$appurl = substr_replace($appurl, '', -1);
|
|
}
|
|
}
|
|
|
|
|
|
- setEnvironmentValue('APP_NAME', $appname);
|
|
|
|
- setEnvironmentValue('APP_URL', $appurl);
|
|
|
|
|
|
+ setenv('APP_NAME', $appname);
|
|
|
|
+ setenv('APP_URL', $appurl);
|
|
|
|
|
|
|
|
+ wh_log('App settings set', 'debug');
|
|
header('LOCATION: index.php?step=4');
|
|
header('LOCATION: index.php?step=4');
|
|
}
|
|
}
|
|
|
|
|
|
if (isset($_POST['feedDB'])) {
|
|
if (isset($_POST['feedDB'])) {
|
|
|
|
+ wh_log('Feeding the Database', 'debug');
|
|
$logs = '';
|
|
$logs = '';
|
|
|
|
|
|
- //$logs .= run_console(putenv('COMPOSER_HOME=' . dirname(__FILE__, 3) . '/vendor/bin/composer'));
|
|
|
|
|
|
+ //$logs .= run_console(setenv('COMPOSER_HOME', dirname(__FILE__, 3) . '/vendor/bin/composer'));
|
|
//$logs .= run_console('composer install --no-dev --optimize-autoloader');
|
|
//$logs .= run_console('composer install --no-dev --optimize-autoloader');
|
|
- if (strpos(getEnvironmentValue('APP_KEY'), 'base64') === false) {
|
|
|
|
|
|
+ if (!str_contains(getenv('APP_KEY'), 'base64')) {
|
|
$logs .= run_console('php artisan key:generate --force');
|
|
$logs .= run_console('php artisan key:generate --force');
|
|
} else {
|
|
} else {
|
|
$logs .= "Key already exists. Skipping\n";
|
|
$logs .= "Key already exists. Skipping\n";
|
|
@@ -70,16 +73,19 @@ if (isset($_POST['feedDB'])) {
|
|
$logs .= run_console('php artisan migrate --seed --force');
|
|
$logs .= run_console('php artisan migrate --seed --force');
|
|
$logs .= run_console('php artisan db:seed --class=ExampleItemsSeeder --force');
|
|
$logs .= run_console('php artisan db:seed --class=ExampleItemsSeeder --force');
|
|
|
|
|
|
- wh_log($logs);
|
|
|
|
|
|
+ wh_log($logs, 'debug');
|
|
|
|
|
|
- if (strpos(getEnvironmentValue('APP_KEY'), 'base64') !== false) {
|
|
|
|
|
|
+ if (str_contains(getenv('APP_KEY'), 'base64')) {
|
|
|
|
+ wh_log('Feeding the Database successful', 'debug');
|
|
header('LOCATION: index.php?step=3');
|
|
header('LOCATION: index.php?step=3');
|
|
} else {
|
|
} else {
|
|
|
|
+ wh_log('Feeding the Database failed', 'debug');
|
|
header('LOCATION: index.php?step=2.5&message=There was an error. Please check the .txt file in /var/www/controlpanel/public/install/logs !');
|
|
header('LOCATION: index.php?step=2.5&message=There was an error. Please check the .txt file in /var/www/controlpanel/public/install/logs !');
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
if (isset($_POST['checkSMTP'])) {
|
|
if (isset($_POST['checkSMTP'])) {
|
|
|
|
+ wh_log('Checking SMTP Settings', 'debug');
|
|
try {
|
|
try {
|
|
$mail = new PHPMailer(true);
|
|
$mail = new PHPMailer(true);
|
|
|
|
|
|
@@ -103,13 +109,16 @@ if (isset($_POST['checkSMTP'])) {
|
|
|
|
|
|
$mail->send();
|
|
$mail->send();
|
|
} catch (Exception $e) {
|
|
} catch (Exception $e) {
|
|
|
|
+ wh_log($mail->ErrorInfo, 'error');
|
|
header('LOCATION: index.php?step=4&message=Something wasnt right when sending the E-Mail!');
|
|
header('LOCATION: index.php?step=4&message=Something wasnt right when sending the E-Mail!');
|
|
exit();
|
|
exit();
|
|
}
|
|
}
|
|
|
|
|
|
- $db = new mysqli(getEnvironmentValue('DB_HOST'), getEnvironmentValue('DB_USERNAME'), getEnvironmentValue('DB_PASSWORD'), getEnvironmentValue('DB_DATABASE'), getEnvironmentValue('DB_PORT'));
|
|
|
|
|
|
+ wh_log('SMTP Settings are correct', 'debug');
|
|
|
|
+ wh_log('Updating Database', 'debug');
|
|
|
|
+ $db = new mysqli(getenv('DB_HOST'), getenv('DB_USERNAME'), getenv('DB_PASSWORD'), getenv('DB_DATABASE'), getenv('DB_PORT'));
|
|
if ($db->connect_error) {
|
|
if ($db->connect_error) {
|
|
- wh_log($db->connect_error);
|
|
|
|
|
|
+ wh_log($db->connect_error, 'error');
|
|
header('LOCATION: index.php?step=4&message=Could not connect to the Database: ');
|
|
header('LOCATION: index.php?step=4&message=Could not connect to the Database: ');
|
|
exit();
|
|
exit();
|
|
}
|
|
}
|
|
@@ -118,20 +127,23 @@ if (isset($_POST['checkSMTP'])) {
|
|
'mail_host' => $_POST['host'],
|
|
'mail_host' => $_POST['host'],
|
|
'mail_port' => $_POST['port'],
|
|
'mail_port' => $_POST['port'],
|
|
'mail_username' => $_POST['user'],
|
|
'mail_username' => $_POST['user'],
|
|
- 'mail_password' => $_POST['pass'],
|
|
|
|
|
|
+ 'mail_password' => encryptSettingsValue($_POST['pass']),
|
|
'mail_encryption' => $_POST['encryption'],
|
|
'mail_encryption' => $_POST['encryption'],
|
|
'mail_from_address' => $_POST['user'],
|
|
'mail_from_address' => $_POST['user'],
|
|
];
|
|
];
|
|
|
|
|
|
foreach ($values as $key => $value) {
|
|
foreach ($values as $key => $value) {
|
|
- $query = 'UPDATE `'.getEnvironmentValue('DB_DATABASE')."`.`settings` SET `payload` = '$value' WHERE `name` = '$key' AND `group` = mail";
|
|
|
|
|
|
+ $query = 'UPDATE `' . getenv('DB_DATABASE') . "`.`settings` SET `payload` = '$value' WHERE `name` = '$key' AND `group` = mail";
|
|
$db->query($query);
|
|
$db->query($query);
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ wh_log('Database updated', 'debug');
|
|
header('LOCATION: index.php?step=5');
|
|
header('LOCATION: index.php?step=5');
|
|
}
|
|
}
|
|
|
|
|
|
if (isset($_POST['checkPtero'])) {
|
|
if (isset($_POST['checkPtero'])) {
|
|
|
|
+ wh_log('Checking Pterodactyl Settings', 'debug');
|
|
|
|
+
|
|
$url = $_POST['url'];
|
|
$url = $_POST['url'];
|
|
$key = $_POST['key'];
|
|
$key = $_POST['key'];
|
|
$clientkey = $_POST['clientkey'];
|
|
$clientkey = $_POST['clientkey'];
|
|
@@ -140,67 +152,75 @@ if (isset($_POST['checkPtero'])) {
|
|
$url = substr_replace($url, '', -1);
|
|
$url = substr_replace($url, '', -1);
|
|
}
|
|
}
|
|
|
|
|
|
- $callpteroURL = $url.'/api/client/account';
|
|
|
|
|
|
+ $callpteroURL = $url . '/api/client/account';
|
|
$call = curl_init();
|
|
$call = curl_init();
|
|
|
|
|
|
curl_setopt($call, CURLOPT_URL, $callpteroURL);
|
|
curl_setopt($call, CURLOPT_URL, $callpteroURL);
|
|
curl_setopt($call, CURLOPT_RETURNTRANSFER, true);
|
|
curl_setopt($call, CURLOPT_RETURNTRANSFER, true);
|
|
curl_setopt($call, CURLOPT_HTTPHEADER, [
|
|
curl_setopt($call, CURLOPT_HTTPHEADER, [
|
|
- 'Accept: application/json',
|
|
|
|
|
|
+ 'Accept: Application/vnd.pterodactyl.v1+json',
|
|
'Content-Type: application/json',
|
|
'Content-Type: application/json',
|
|
- 'Authorization: Bearer '.$clientkey,
|
|
|
|
|
|
+ 'Authorization: Bearer ' . $clientkey,
|
|
]);
|
|
]);
|
|
$callresponse = curl_exec($call);
|
|
$callresponse = curl_exec($call);
|
|
$callresult = json_decode($callresponse, true);
|
|
$callresult = json_decode($callresponse, true);
|
|
curl_close($call); // Close the connection
|
|
curl_close($call); // Close the connection
|
|
|
|
|
|
- $pteroURL = $url.'/api/application/users';
|
|
|
|
|
|
+ $pteroURL = $url . '/api/application/users';
|
|
$ch = curl_init();
|
|
$ch = curl_init();
|
|
|
|
|
|
curl_setopt($ch, CURLOPT_URL, $pteroURL);
|
|
curl_setopt($ch, CURLOPT_URL, $pteroURL);
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
|
|
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
|
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
|
- 'Accept: application/json',
|
|
|
|
|
|
+ 'Accept: Application/vnd.pterodactyl.v1+json',
|
|
'Content-Type: application/json',
|
|
'Content-Type: application/json',
|
|
- 'Authorization: Bearer '.$key,
|
|
|
|
|
|
+ 'Authorization: Bearer ' . $key,
|
|
]);
|
|
]);
|
|
$response = curl_exec($ch);
|
|
$response = curl_exec($ch);
|
|
$result = json_decode($response, true);
|
|
$result = json_decode($response, true);
|
|
curl_close($ch); // Close the connection
|
|
curl_close($ch); // Close the connection
|
|
|
|
|
|
- if (! is_array($result) or in_array($result['errors'][0]['code'], $result)) {
|
|
|
|
- header('LOCATION: index.php?step=5&message=Couldnt connect to Pterodactyl. Make sure your API key has all read and write permissions!');
|
|
|
|
- wh_log('API CALL ERROR: '.$result['errors'][0]['code']);
|
|
|
|
|
|
+ if (!is_array($result) and $result['errors'][0] !== null) {
|
|
|
|
+ header('LOCATION: index.php?step=5&message=Couldn\'t connect to Pterodactyl. Make sure your API key has all read and write permissions!');
|
|
|
|
+ wh_log('API CALL ERROR: ' . $result['errors'][0]['code'], 'error');
|
|
exit();
|
|
exit();
|
|
- } elseif (! is_array($callresult) or in_array($result['errors'][0]['code'], $result) or $callresult['attributes']['admin'] == false) {
|
|
|
|
|
|
+ } elseif (!is_array($callresult) and $callresult['errors'][0] !== null or $callresult['attributes']['admin'] == false) {
|
|
header('LOCATION: index.php?step=5&message=Your ClientAPI Key is wrong or the account is not an admin!');
|
|
header('LOCATION: index.php?step=5&message=Your ClientAPI Key is wrong or the account is not an admin!');
|
|
- wh_log('API CALL ERROR: '.$result['errors'][0]['code']);
|
|
|
|
|
|
+ wh_log('API CALL ERROR: ' . $callresult['errors'][0]['code'], 'error');
|
|
exit();
|
|
exit();
|
|
} else {
|
|
} else {
|
|
- $query1 = 'UPDATE `'.getEnvironmentValue('DB_DATABASE')."`.`settings` SET `payload` = '$url' WHERE (`name` = 'panel_url' AND `group` = 'pterodactyl')";
|
|
|
|
- $query2 = 'UPDATE `'.getEnvironmentValue('DB_DATABASE')."`.`settings` SET `payload` = '$key' WHERE (`name` = 'admin_token' AND `group` = 'pterodactyl')";
|
|
|
|
- $query3 = 'UPDATE `'.getEnvironmentValue('DB_DATABASE')."`.`settings` SET `payload` = '$clientkey' WHERE (`name` = 'user_token' AND `group` = 'pterodactyl')";
|
|
|
|
|
|
+ wh_log('Pterodactyl Settings are correct', 'debug');
|
|
|
|
+ wh_log('Updating Database', 'debug');
|
|
|
|
+
|
|
|
|
+ $key = encryptSettingsValue($key);
|
|
|
|
+ $clientkey = encryptSettingsValue($clientkey);
|
|
|
|
|
|
- $db = new mysqli(getEnvironmentValue('DB_HOST'), getEnvironmentValue('DB_USERNAME'), getEnvironmentValue('DB_PASSWORD'), getEnvironmentValue('DB_DATABASE'), getEnvironmentValue('DB_PORT'));
|
|
|
|
|
|
+ $query1 = 'UPDATE `' . getenv('DB_DATABASE') . "`.`settings` SET `payload` = '" . json_encode($url) . "' WHERE (`name` = 'panel_url' AND `group` = 'pterodactyl')";
|
|
|
|
+ $query2 = 'UPDATE `' . getenv('DB_DATABASE') . "`.`settings` SET `payload` = '" . json_encode($key) . "' WHERE (`name` = 'admin_token' AND `group` = 'pterodactyl')";
|
|
|
|
+ $query3 = 'UPDATE `' . getenv('DB_DATABASE') . "`.`settings` SET `payload` = '" . json_encode($clientkey) . "' WHERE (`name` = 'user_token' AND `group` = 'pterodactyl')";
|
|
|
|
+
|
|
|
|
+ $db = new mysqli(getenv('DB_HOST'), getenv('DB_USERNAME'), getenv('DB_PASSWORD'), getenv('DB_DATABASE'), getenv('DB_PORT'));
|
|
if ($db->connect_error) {
|
|
if ($db->connect_error) {
|
|
- wh_log($db->connect_error);
|
|
|
|
|
|
+ wh_log($db->connect_error, 'error');
|
|
header('LOCATION: index.php?step=5&message=Could not connect to the Database');
|
|
header('LOCATION: index.php?step=5&message=Could not connect to the Database');
|
|
exit();
|
|
exit();
|
|
}
|
|
}
|
|
|
|
|
|
if ($db->query($query1) && $db->query($query2) && $db->query($query3)) {
|
|
if ($db->query($query1) && $db->query($query2) && $db->query($query3)) {
|
|
|
|
+ wh_log('Database updated', 'debug');
|
|
header('LOCATION: index.php?step=6');
|
|
header('LOCATION: index.php?step=6');
|
|
} else {
|
|
} else {
|
|
- wh_log($db->error);
|
|
|
|
|
|
+ wh_log($db->error, 'error');
|
|
header('LOCATION: index.php?step=5&message=Something went wrong when communicating with the Database!');
|
|
header('LOCATION: index.php?step=5&message=Something went wrong when communicating with the Database!');
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
if (isset($_POST['createUser'])) {
|
|
if (isset($_POST['createUser'])) {
|
|
- $db = new mysqli(getEnvironmentValue('DB_HOST'), getEnvironmentValue('DB_USERNAME'), getEnvironmentValue('DB_PASSWORD'), getEnvironmentValue('DB_DATABASE'), getEnvironmentValue('DB_PORT'));
|
|
|
|
|
|
+ wh_log('Creating User', 'debug');
|
|
|
|
+ $db = new mysqli(getenv('DB_HOST'), getenv('DB_USERNAME'), getenv('DB_PASSWORD'), getenv('DB_DATABASE'), getenv('DB_PORT'));
|
|
if ($db->connect_error) {
|
|
if ($db->connect_error) {
|
|
- wh_log($db->connect_error);
|
|
|
|
|
|
+ wh_log($db->connect_error, 'error');
|
|
header('LOCATION: index.php?step=6&message=Could not connect to the Database');
|
|
header('LOCATION: index.php?step=6&message=Could not connect to the Database');
|
|
exit();
|
|
exit();
|
|
}
|
|
}
|
|
@@ -209,10 +229,11 @@ if (isset($_POST['createUser'])) {
|
|
$pass = $_POST['pass'];
|
|
$pass = $_POST['pass'];
|
|
$repass = $_POST['repass'];
|
|
$repass = $_POST['repass'];
|
|
|
|
|
|
- $key = $db->query('SELECT `payload` FROM `'.getEnvironmentValue('DB_DATABASE')."`.`settings` WHERE `name` = 'admin_token' AND `group` = 'pterodactyl'")->fetch_assoc();
|
|
|
|
- $pterobaseurl = $db->query('SELECT `payload` FROM `'.getEnvironmentValue('DB_DATABASE')."`.`settings` WHERE `name` = 'panel_url' AND `group` = 'pterodactyl'")->fetch_assoc();
|
|
|
|
|
|
+ $key = $db->query('SELECT `payload` FROM `' . getenv('DB_DATABASE') . "`.`settings` WHERE `name` = 'admin_token' AND `group` = 'pterodactyl'")->fetch_assoc();
|
|
|
|
+ $key = encryptSettingsValue($key['value']);
|
|
|
|
+ $pterobaseurl = $db->query('SELECT `payload` FROM `' . getenv('DB_DATABASE') . "`.`settings` WHERE `name` = 'panel_url' AND `group` = 'pterodactyl'")->fetch_assoc();
|
|
|
|
|
|
- $pteroURL = $pterobaseurl['value'].'/api/application/users/'.$pteroID;
|
|
|
|
|
|
+ $pteroURL = $pterobaseurl['value'] . '/api/application/users/' . $pteroID;
|
|
$ch = curl_init();
|
|
$ch = curl_init();
|
|
|
|
|
|
curl_setopt($ch, CURLOPT_URL, $pteroURL);
|
|
curl_setopt($ch, CURLOPT_URL, $pteroURL);
|
|
@@ -220,14 +241,14 @@ if (isset($_POST['createUser'])) {
|
|
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
|
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
|
'Accept: application/json',
|
|
'Accept: application/json',
|
|
'Content-Type: application/json',
|
|
'Content-Type: application/json',
|
|
- 'Authorization: Bearer '.$key['value'],
|
|
|
|
|
|
+ 'Authorization: Bearer ' . $key,
|
|
]);
|
|
]);
|
|
$response = curl_exec($ch);
|
|
$response = curl_exec($ch);
|
|
$result = json_decode($response, true);
|
|
$result = json_decode($response, true);
|
|
curl_close($ch); // Close the connection
|
|
curl_close($ch); // Close the connection
|
|
|
|
|
|
- if (! $result['attributes']['email']) {
|
|
|
|
- header('LOCATION: index.php?step=6&message=Could not find the user with pterodactyl ID '.$pteroID);
|
|
|
|
|
|
+ if (!$result['attributes']['email']) {
|
|
|
|
+ header('LOCATION: index.php?step=6&message=Could not find the user with pterodactyl ID ' . $pteroID);
|
|
exit();
|
|
exit();
|
|
}
|
|
}
|
|
if ($pass !== $repass) {
|
|
if ($pass !== $repass) {
|
|
@@ -239,7 +260,7 @@ if (isset($_POST['createUser'])) {
|
|
$name = $result['attributes']['username'];
|
|
$name = $result['attributes']['username'];
|
|
$pass = password_hash($pass, PASSWORD_DEFAULT);
|
|
$pass = password_hash($pass, PASSWORD_DEFAULT);
|
|
|
|
|
|
- $pteroURL = $pterobaseurl['value'].'/api/application/users/'.$pteroID;
|
|
|
|
|
|
+ $pteroURL = $pterobaseurl['value'] . '/api/application/users/' . $pteroID;
|
|
$ch = curl_init();
|
|
$ch = curl_init();
|
|
|
|
|
|
curl_setopt($ch, CURLOPT_URL, $pteroURL);
|
|
curl_setopt($ch, CURLOPT_URL, $pteroURL);
|
|
@@ -247,7 +268,7 @@ if (isset($_POST['createUser'])) {
|
|
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
|
curl_setopt($ch, CURLOPT_HTTPHEADER, [
|
|
'Accept: application/json',
|
|
'Accept: application/json',
|
|
'Content-Type: application/json',
|
|
'Content-Type: application/json',
|
|
- 'Authorization: Bearer '.$key['value'],
|
|
|
|
|
|
+ 'Authorization: Bearer ' . $key['value'],
|
|
]);
|
|
]);
|
|
curl_setopt($ch, CURLOPT_POSTFIELDS, [
|
|
curl_setopt($ch, CURLOPT_POSTFIELDS, [
|
|
'email' => $mail,
|
|
'email' => $mail,
|
|
@@ -260,19 +281,19 @@ if (isset($_POST['createUser'])) {
|
|
$result = json_decode($response, true);
|
|
$result = json_decode($response, true);
|
|
curl_close($ch); // Close the connection
|
|
curl_close($ch); // Close the connection
|
|
|
|
|
|
- if (! is_array($result) or in_array($result['errors'][0]['code'], $result)) {
|
|
|
|
- header('LOCATION: index.php?step=5&message=Couldnt connect to Pterodactyl. Make sure your API key has all read and write permissions!');
|
|
|
|
|
|
+ if (!is_array($result) or in_array($result['errors'][0]['code'], $result)) {
|
|
|
|
+ header('LOCATION: index.php?step=5&message=Couldn\'t connect to Pterodactyl. Make sure your API key has all read and write permissions!');
|
|
exit();
|
|
exit();
|
|
}
|
|
}
|
|
|
|
|
|
$random = generateRandomString();
|
|
$random = generateRandomString();
|
|
- $query1 = 'INSERT INTO `'.getEnvironmentValue('DB_DATABASE')."`.`users` (`name`, `role`, `credits`, `server_limit`, `pterodactyl_id`, `email`, `password`, `created_at`, `referral_code`) VALUES ('$name', 'admin', '250', '1', '$pteroID', '$mail', '$pass', CURRENT_TIMESTAMP, '$random')";
|
|
|
|
|
|
+ $query1 = 'INSERT INTO `' . getenv('DB_DATABASE') . "`.`users` (`name`, `role`, `credits`, `server_limit`, `pterodactyl_id`, `email`, `password`, `created_at`, `referral_code`) VALUES ('$name', 'admin', '250', '1', '$pteroID', '$mail', '$pass', CURRENT_TIMESTAMP, '$random')";
|
|
|
|
|
|
if ($db->query($query1)) {
|
|
if ($db->query($query1)) {
|
|
- wh_log('[USER MAKER] Created user with Email '.$mail.' and pterodactyl ID '.$pteroID);
|
|
|
|
|
|
+ wh_log('Created user with Email ' . $mail . ' and pterodactyl ID ' . $pteroID, 'info');
|
|
header('LOCATION: index.php?step=7');
|
|
header('LOCATION: index.php?step=7');
|
|
} else {
|
|
} else {
|
|
- wh_log($db->error);
|
|
|
|
|
|
+ wh_log($db->error, 'error');
|
|
header('LOCATION: index.php?step=6&message=Something went wrong when communicating with the Database');
|
|
header('LOCATION: index.php?step=6&message=Something went wrong when communicating with the Database');
|
|
}
|
|
}
|
|
-}
|
|
|
|
|
|
+}
|