diff --git a/public/install/forms.php b/public/install/forms.php index 5c56ecdd..348aa08c 100644 --- a/public/install/forms.php +++ b/public/install/forms.php @@ -9,6 +9,7 @@ require 'phpmailer/SMTP.php'; include 'functions.php'; +mysqli_report(MYSQLI_REPORT_STRICT | MYSQLI_REPORT_ALL); if (isset($_POST['checkDB'])) { $values = [ @@ -23,12 +24,15 @@ if (isset($_POST['checkDB'])) { wh_log('Trying to connect to the Database', 'debug'); - $db = new mysqli($_POST['databasehost'], $_POST['databaseuser'], $_POST['databaseuserpass'], $_POST['database'], $_POST['databaseport']); - if ($db->connect_error) { - wh_log($db->connect_error, 'error'); - header('LOCATION: index.php?step=2&message=Could not connect to the Database'); + try { + $db = new mysqli($_POST['databasehost'], $_POST['databaseuser'], $_POST['databaseuserpass'], $_POST['database'], $_POST['databaseport']); + } + catch (mysqli_sql_exception $e) { + wh_log($e->getMessage(), 'error'); + header('LOCATION: index.php?step=2&message=' . $e->getMessage()); exit(); } + foreach ($values as $key => $value) { $param = $_POST[$value]; diff --git a/public/install/functions.php b/public/install/functions.php index 6ad3beca..684987e4 100644 --- a/public/install/functions.php +++ b/public/install/functions.php @@ -179,7 +179,7 @@ function encryptSettingsValue(mixed $value, $serialize = true): string { $appKey = getenv('APP_KEY'); $appKey = base64_decode(Str::after($appKey, 'base64:')); - $encrypter = new Encrypter($appKey); + $encrypter = new Encrypter($appKey, 'AES-256-CBC'); $encryptedKey = $encrypter->encrypt($value, $serialize); return $encryptedKey; @@ -196,7 +196,7 @@ function decryptSettingsValue(mixed $payload, $unserialize = true) { $appKey = getenv('APP_KEY'); $appKey = base64_decode(Str::after($appKey, 'base64:')); - $encrypter = new Encrypter($appKey); + $encrypter = new Encrypter($appKey, 'AES-256-CBC'); $decryptedKey = $encrypter->decrypt($payload, $unserialize); return $decryptedKey; diff --git a/public/install/index.php b/public/install/index.php index 027ae3d1..688054b6 100644 --- a/public/install/index.php +++ b/public/install/index.php @@ -4,456 +4,438 @@ include 'functions.php'; if (file_exists('../../install.lock')) { exit("The installation has been completed already. Please delete the File 'install.lock' to re-run"); } + +function cardStart($title, $subtitle = null) +{ + return " +
$subtitle
" : ""); +} ?> +This installer will lead you through the most crucial Steps of Controlpanel.gg`s - setup
-HTTPS is required
-Write-permissions on .env-file
+ // DB Config + if (isset($_GET['step']) && $_GET['step'] == 2) { -php - version: (minimum required )
+ echo cardStart($title = "Database Configuration"); ?> -mysql - version: (minimum required )
+Lets start with your Database
- " . $_GET['message'] . ''; - } ?> - -Lets create yourself!
-We're making the first Admin user
- " . $_GET['message'] . ''; - } ?> - -All done!
-You may navigate to your Dashboard now and log in!
- - - - + echo cardStart($title = "Pterodactyl Configuration", $subtitle = "Lets get some info about your Pterodactyl Installation!"); ?> + +