formatting and user creating

This commit is contained in:
1day2die 2022-01-11 19:54:32 +01:00
parent f589f26e23
commit 2218ec21a5
4 changed files with 710 additions and 504 deletions

1
.gitignore vendored
View file

@ -21,3 +21,4 @@ yarn-error.log
storage/invoices.zip storage/invoices.zip
storage/app/public/logo.png storage/app/public/logo.png
*vscode *vscode
- Kopie.env

View file

@ -1,161 +1,242 @@
<?php <?php
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\SMTP;
use PHPMailer\PHPMailer\Exception;
use DevCoder\DotEnv;
require 'dotenv.php'; use DevCoder\DotEnv;
require 'phpmailer/Exception.php'; use PHPMailer\PHPMailer\Exception;
require 'phpmailer/PHPMailer.php'; use PHPMailer\PHPMailer\PHPMailer;
require 'phpmailer/SMTP.php';
require 'dotenv.php';
require 'phpmailer/Exception.php';
require 'phpmailer/PHPMailer.php';
require 'phpmailer/SMTP.php';
(new DotEnv(dirname(__FILE__,3)."/.env"))->load(); (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)
"DB_HOST" => "databasehost", "DB_HOST" => "databasehost",
"DB_DATABASE" => "database", "DB_DATABASE" => "database",
"DB_USERNAME" => "databaseuser", "DB_USERNAME" => "databaseuser",
"DB_PASSWORD" => "databaseuserpass", "DB_PASSWORD" => "databaseuserpass",
"DB_PORT" => "databaseport", "DB_PORT" => "databaseport",
"DB_CONNECTION" => "databasedriver" "DB_CONNECTION" => "databasedriver"
]; ];
$db = new mysqli($_POST["databasehost"], $_POST["databaseuser"], $_POST["databaseuserpass"], $_POST["database"], $_POST["databaseport"]);
if ($db->connect_error) {
header("LOCATION: index.php?step=2&message=Could not connect to the Database");
die();
}
$db = new mysqli($_POST["databasehost"], $_POST["databaseuser"], $_POST["databaseuserpass"], $_POST["database"], $_POST["databaseport"]); foreach ($values as $key => $value) {
if ($db->connect_error) { $param = $_POST[$value];
header("LOCATION: index.php?step=2&message=Could not connect to the Database"); setEnvironmentValue($key, $param);
die(); }
} header("LOCATION: index.php?step=3");
foreach ($values as $key => $value) { }
$param = $_POST[$value];
setEnvironmentValue($key, $param);
}
header("LOCATION: index.php?step=3");
}
if(isset($_POST['checkGeneral'])){ if (isset($_POST['checkGeneral'])) {
$values = [
//SETTINGS::VALUE => REQUEST-VALUE (coming from the html-form)
"APP_NAME" => "name",
"APP_URL" => "url"
];
foreach ($values as $key => $value) { $appname = '"' . $_POST['name'] . '"';
$param = $_POST[$value]; $appurl = $_POST['url'];
setEnvironmentValue($key, $param);
}
header("LOCATION: index.php?step=4");
}
if(isset($_POST['checkSMTP'])){ if (substr($appurl, -1) === "/") {
try{ $appurl = substr_replace($appurl, "", -1);
}
setEnvironmentValue("APP_NAME", $appname);
setEnvironmentValue("APP_URL", $url);
header("LOCATION: index.php?step=4");
}
if (isset($_POST['checkSMTP'])) {
try {
$mail = new PHPMailer(true); $mail = new PHPMailer(true);
//Server settings //Server settings
$mail->isSMTP(); // Send using SMTP $mail->isSMTP(); // Send using SMTP
$mail->Host = $_POST['host']; // Set the SMTP server to send through $mail->Host = $_POST['host']; // Set the SMTP server to send through
$mail->SMTPAuth = true; // Enable SMTP authentication $mail->SMTPAuth = true; // Enable SMTP authentication
$mail->Username = $_POST['user']; // SMTP username $mail->Username = $_POST['user']; // SMTP username
$mail->Password = $_POST['pass']; // SMTP password $mail->Password = $_POST['pass']; // SMTP password
$mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; // Enable TLS encryption; `PHPMailer::ENCRYPTION_SMTPS` encouraged $mail->SMTPSecure = PHPMailer::ENCRYPTION_STARTTLS; // Enable TLS encryption; `PHPMailer::ENCRYPTION_SMTPS` encouraged
$mail->Port = $_POST['port']; // TCP port to connect to, use 465 for `PHPMailer::ENCRYPTION_SMTPS` $mail->Port = $_POST['port']; // TCP port to connect to, use 465 for `PHPMailer::ENCRYPTION_SMTPS`
//Recipients //Recipients
$mail->setFrom($_POST['user'], $_POST['user']); $mail->setFrom($_POST['user'], $_POST['user']);
$mail->addAddress($_POST['user'], $_POST['user']); // Add a recipient $mail->addAddress($_POST['user'], $_POST['user']); // Add a recipient
// Content // Content
$mail->isHTML(true); // Set email format to HTML $mail->isHTML(true); // Set email format to HTML
$mail->Subject = 'It Worked!'; $mail->Subject = 'It Worked!';
$mail->Body = "Your E-Mail Settings are correct!"; $mail->Body = "Your E-Mail Settings are correct!";
$mail->send(); $mail->send();
}catch (Exception $e){ } catch (Exception $e) {
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!");
die(); die();
} }
$values = [ $values = [
//SETTINGS::VALUE => REQUEST-VALUE (coming from the html-form) //SETTINGS::VALUE => REQUEST-VALUE (coming from the html-form)
"MAIL_MAILER" => "method", "MAIL_MAILER" => "method",
"MAIL_HOST" => "host", "MAIL_HOST" => "host",
"MAIL_PORT" => "port", "MAIL_PORT" => "port",
"MAIL_USERNAME" => "user", "MAIL_USERNAME" => "user",
"MAIL_PASSWORD" => "pass", "MAIL_PASSWORD" => "pass",
"MAIL_ENCRYPTION" => "encryption", "MAIL_ENCRYPTION" => "encryption",
"MAIL_FROM_ADDRESS" => "user" "MAIL_FROM_ADDRESS" => "user"
]; ];
foreach ($values as $key => $value) { foreach ($values as $key => $value) {
$param = $_POST[$value]; $param = $_POST[$value];
setEnvironmentValue($key, $param); setEnvironmentValue($key, $param);
} }
header("LOCATION: index.php?step=5"); header("LOCATION: index.php?step=5");
}
if(isset($_POST['checkPtero'])){
$url = $_POST['url'];
$key = $_POST['key'];
if(substr($url, -1)==="/"){
$url = substr_replace($url ,"", -1);
}
$pteroURL = $url."/api/application/users"; }
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $pteroURL); if (isset($_POST['checkPtero'])) {
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true); $url = $_POST['url'];
curl_setopt($ch, CURLOPT_HTTPHEADER, array( $key = $_POST['key'];
"Accept: application/json",
"Content-Type: application/json", if (substr($url, -1) === "/") {
"Authorization: Bearer " . $key $url = substr_replace($url, "", -1);
)); }
$response = curl_exec($ch);
$result = json_decode($response, true);
curl_close($ch); // Close the connection
if(!is_array($result) or in_array($result["errors"][0]["code"],$result)){ $pteroURL = $url . "/api/application/users";
header("LOCATION: index.php?step=5&message=Couldnt connect to Pterodactyl. Make sure your API key has all read and write permissions!"); $ch = curl_init();
die();
}else{
$query1= "UPDATE `dashboard`.`settings` SET `value` = '$url' WHERE (`key` = 'SETTINGS::SYSTEM:PTERODACTYL:URL')";
$query2= "UPDATE `dashboard`.`settings` SET `value` = '$key' WHERE (`key` = 'SETTINGS::SYSTEM:PTERODACTYL:TOKEN')";
$db = new mysqli(getenv("DB_HOST"), getenv("DB_USERNAME"), getenv("DB_PASSWORD"), getenv("DB_DATABASE"), getenv("DB_PORT")); curl_setopt($ch, CURLOPT_URL, $pteroURL);
if ($db->connect_error) { curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
header("LOCATION: index.php?step=5&message=Could not connect to the Database"); curl_setopt($ch, CURLOPT_HTTPHEADER, array(
die(); "Accept: application/json",
} "Content-Type: application/json",
"Authorization: Bearer " . $key
if($db->query($query1) && $db->query($query2)){ ));
header("LOCATION: index.php?step=6"); $response = curl_exec($ch);
}else{ $result = json_decode($response, true);
header("LOCATION: index.php?step=5&message=Something went wrong when communicating with the Database!"); 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!");
die();
} else {
$query1 = "UPDATE `dashboard`.`settings` SET `value` = '$url' WHERE (`key` = 'SETTINGS::SYSTEM:PTERODACTYL:URL')";
$query2 = "UPDATE `dashboard`.`settings` SET `value` = '$key' WHERE (`key` = 'SETTINGS::SYSTEM:PTERODACTYL:TOKEN')";
$db = new mysqli(getenv("DB_HOST"), getenv("DB_USERNAME"), getenv("DB_PASSWORD"), getenv("DB_DATABASE"), getenv("DB_PORT"));
if ($db->connect_error) {
header("LOCATION: index.php?step=5&message=Could not connect to the Database");
die();
}
if ($db->query($query1) && $db->query($query2)) {
header("LOCATION: index.php?step=6");
} else {
header("LOCATION: index.php?step=5&message=Something went wrong when communicating with the Database!");
}
}
}
if (isset($_POST['createUser'])) {
$db = new mysqli(getenv("DB_HOST"), getenv("DB_USERNAME"), getenv("DB_PASSWORD"), getenv("DB_DATABASE"), getenv("DB_PORT"));
if ($db->connect_error) {
header("LOCATION: index.php?step=6&message=Could not connect to the Database");
die();
}
$name = $_POST['user'];
$mail = $_POST['email'];
$pteroID = $_POST['pteroID'];
$pass = $_POST['pass'];
$repass = $_POST['repass'];
$key = $db->query("SELECT `value` FROM dashboard.settings WHERE `key` = 'SETTINGS::SYSTEM:PTERODACTYL:TOKEN'")->fetch_assoc();
$pterobaseurl = $db->query("SELECT `value` FROM dashboard.settings WHERE `key` = 'SETTINGS::SYSTEM:PTERODACTYL:URL'")->fetch_assoc();
$pteroURL = $pterobaseurl["value"] . "/api/application/users/" . $pteroID;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $pteroURL);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"Accept: application/json",
"Content-Type: application/json",
"Authorization: Bearer " . $key["value"]
));
$response = curl_exec($ch);
$result = json_decode($response, true);
curl_close($ch); // Close the connection
if ($result["attributes"]["email"] !== $mail) {
header("LOCATION: index.php?step=6&message=The Email is not the same as the one used on Pterodactyl");
die();
}
if ($pass !== $repass) {
header("LOCATION: index.php?step=6&message=The Passwords did not match!");
die();
}
$pass = password_hash($pass, PASSWORD_DEFAULT);
$pteroURL = $pterobaseurl["value"] . "/api/application/users/" . $pteroID;
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, $pteroURL);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, array(
"Accept: application/json",
"Content-Type: application/json",
"Authorization: Bearer " . $key["value"]
));
curl_setopt($ch, CURLOPT_POSTFIELDS, array(
"email" => $mail,
"username" => $name,
"first_name" => $name,
"last_name" => $name,
"password" => $pass
));
$response = curl_exec($ch);
$result = json_decode($response, true);
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!");
die();
}
$query1 = "INSERT INTO `dashboard`.`users` (`name`, `role`, `credits`, `server_limit`, `pterodactyl_id`, `email`, `password`) VALUES ('$name', 'admin', '250', '1', '$pteroID', '$mail', '$pass')";
if ($db->query($query1)) {
header("LOCATION: index.php?step=7");
} else {
header("LOCATION: index.php?step=6&message=Something went wrong when communicating with the Database!");
}
}
?>

View file

@ -1,100 +1,105 @@
<?php <?php
$required_extentions=array("openssl","gd","mysql","PDO","mbstring","tokenizer","bcmath","xml","curl","zip","fpm"); $required_extentions = array("openssl", "gd", "mysql", "PDO", "mbstring", "tokenizer", "bcmath", "xml", "curl", "zip", "fpm");
$requirements = [ $requirements = [
"php"=> "7.4", "php" => "7.4",
"mysql"=>"5.7.22", "mysql" => "5.7.22",
]; ];
function checkPhpVersion(){ function checkPhpVersion()
global $requirements; {
if (version_compare(phpversion(), $requirements["php"], '>=')){ global $requirements;
return "OK"; if (version_compare(phpversion(), $requirements["php"], '>=')) {
} return "OK";
return "not OK";
}
function getMySQLVersion() {
global $requirements;
$output = shell_exec('mysql -V');
preg_match('@[0-9]+\.[0-9]+\.[0-9]+@', $output, $version);
$versionoutput = $version[0] ?? "0";
return (intval($versionoutput) > intval($requirements["mysql"]) ? "OK":$versionoutput);;
}
function getZipVersion() {
global $requirements;
$output = shell_exec('zip -v');
preg_match('@[0-9]+\.[0-9]+\.[0-9]+@', $output, $version);
$versionoutput = $version[0] ?? 0;
return ($versionoutput!=0 ? "OK":"not OK");;
}
function getGitVersion() {
global $requirements;
$output = shell_exec('git --version');
preg_match('@[0-9]+\.[0-9]+\.[0-9]+@', $output, $version);
$versionoutput = $version[0] ?? 0;
return ($versionoutput!=0 ? "OK":"not OK");;
}
function getTarVersion() {
global $requirements;
$output = shell_exec('tar --version');
preg_match('@[0-9]+\.[0-9]+@', $output, $version);
$versionoutput = $version[0] ?? 0;
return ($versionoutput!=0 ? "OK":"not OK");;
}
function checkExtensions(){
global $required_extentions;
$not_ok = [];
$extentions = get_loaded_extensions();
foreach($required_extentions as $ext){
if(!in_array($ext,$extentions)){
array_push($not_ok,$ext);
}
}
return $not_ok;
}
function setEnvironmentValue($envKey, $envValue)
{
$envFile = dirname(__FILE__,3)."/.env";
$str = file_get_contents($envFile);
$str .= "\n"; // In case the searched variable is in the last line without \n
$keyPosition = strpos($str, "{$envKey}=");
$endOfLinePosition = strpos($str, PHP_EOL, $keyPosition);
$oldLine = substr($str, $keyPosition, $endOfLinePosition - $keyPosition);
$str = str_replace($oldLine, "{$envKey}={$envValue}", $str);
$str = substr($str, 0, -1);
$fp = fopen($envFile, 'w');
fwrite($fp, $str);
fclose($fp);
} }
return "not OK";
}
function getMySQLVersion()
{
global $requirements;
$output = shell_exec('mysql -V');
preg_match('@[0-9]+\.[0-9]+\.[0-9]+@', $output, $version);
$versionoutput = $version[0] ?? "0";
return (intval($versionoutput) > intval($requirements["mysql"]) ? "OK" : $versionoutput);
}
function getZipVersion()
{
global $requirements;
$output = shell_exec('zip -v');
preg_match('@[0-9]+\.[0-9]+\.[0-9]+@', $output, $version);
$versionoutput = $version[0] ?? 0;
return ($versionoutput != 0 ? "OK" : "not OK");
}
function getGitVersion()
{
global $requirements;
$output = shell_exec('git --version');
preg_match('@[0-9]+\.[0-9]+\.[0-9]+@', $output, $version);
$versionoutput = $version[0] ?? 0;
return ($versionoutput != 0 ? "OK" : "not OK");
}
function getTarVersion()
{
global $requirements;
$output = shell_exec('tar --version');
preg_match('@[0-9]+\.[0-9]+@', $output, $version);
$versionoutput = $version[0] ?? 0;
return ($versionoutput != 0 ? "OK" : "not OK");
}
function checkExtensions()
{
global $required_extentions;
$not_ok = [];
$extentions = get_loaded_extensions();
foreach ($required_extentions as $ext) {
if (!in_array($ext, $extentions)) {
array_push($not_ok, $ext);
}
}
return $not_ok;
}
function setEnvironmentValue($envKey, $envValue)
{
$envFile = dirname(__FILE__, 3) . "/.env";
$str = file_get_contents($envFile);
$str .= "\n"; // In case the searched variable is in the last line without \n
$keyPosition = strpos($str, "{$envKey}=");
$endOfLinePosition = strpos($str, PHP_EOL, $keyPosition);
$oldLine = substr($str, $keyPosition, $endOfLinePosition - $keyPosition);
$str = str_replace($oldLine, "{$envKey}={$envValue}", $str);
$str = substr($str, 0, -1);
$fp = fopen($envFile, 'w');
fwrite($fp, $str);
fclose($fp);
}
?>
?>

View file

@ -1,351 +1,470 @@
<?php <?php
include ("functions.php"); include("functions.php");
if (file_exists("install.lock")){ if (file_exists("install.lock")) {
die("The installation has been completed already. Please delete the File 'install.lock' to re-run"); die("The installation has been completed already. Please delete the File 'install.lock' to re-run");
} }
?> ?>
<html> <html>
<head> <head>
<title>Controlpanel.gg installer Script</title> <title>Controlpanel.gg installer Script</title>
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet" integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous"> <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet"
integrity="sha384-1BmE4kWBq78iYhFldvKuhfTAU6auU8tT94WrHftjDbrCEXSU1oBoqyl2QvZ6jIW3" crossorigin="anonymous">
<style> <style>
body {background-color: powderblue;} body {
background-color: powderblue;
}
.card { .card {
position: absolute; position: absolute;
top: 50%; top: 50%;
left: 50%; left: 50%;
margin-right: -50%; margin-right: -50%;
transform: translate(-50%, -50%); transform: translate(-50%, -50%);
} }
.ok{
color: green;
}
.ok::before{
content: "✔️";
}
.notok{
color: red;
}
.notok::before{
content: "";
}
</style>
</head>
<body>
<?php if(!isset($_GET['step'])){ ?> .ok {
<div class="card card-outline card-primary"> color: green;
<div class="card-header text-center"> }
<b class="mr-1">Controlpanel.GG</b>
</div>
<div class="card-body"> .ok::before {
<p class="login-box-msg">This installer will lead you through the most crucial Steps of Controlpanel.gg`s setup</p> content: "✔️";
}
<p class="<?php print(checkPhpVersion()==="OK"?"ok":"notok");?>"> php version: <?php echo phpversion();?> (required <?php echo $requirements["php"];?>)</p> .notok {
<p class="<?php print(getMySQLVersion()==="OK"?"ok":"notok");?>"> mysql version: <?php echo getMySQLVersion();?> (minimum required <?php echo $requirements["mysql"];?>)</p> color: red;
}
<p class="<?php print(sizeof(checkExtensions()) == 0?"ok":"notok");?>"> Missing extentions: <?php print(sizeof(checkExtensions()) == 0?"None":"");foreach(checkExtensions() as $ext){ echo $ext.", ";};?> (try to install anyway)</p> .notok::before {
content: "";
}
</style>
</head>
<body>
<p class="<?php print(getZipVersion()==="OK"?"ok":"notok");?>"> Zip version: <?php echo getZipVersion();?> </p> <?php if (!isset($_GET['step'])) { ?>
<div class="card card-outline card-primary">
<div class="card-header text-center">
<b class="mr-1">Controlpanel.GG</b>
</div>
<p class="<?php print(getGitVersion()==="OK"?"ok":"notok");?>"> Git version: <?php echo getGitVersion();?> </p> <div class="card-body">
<p class="login-box-msg">This installer will lead you through the most crucial Steps of Controlpanel.gg`s
setup</p>
<p class="<?php print(getTarVersion()==="OK"?"ok":"notok");?>"> Tar version: <?php echo getTarVersion();?> </p> <p class="<?php print(checkPhpVersion() === "OK" ? "ok" : "notok"); ?>"> php
version: <?php echo phpversion(); ?> (required <?php echo $requirements["php"]; ?>)</p>
<p class="<?php print(getMySQLVersion() === "OK" ? "ok" : "notok"); ?>"> mysql
version: <?php echo getMySQLVersion(); ?> (minimum required <?php echo $requirements["mysql"]; ?>)</p>
<p class="<?php print(sizeof(checkExtensions()) == 0 ? "ok" : "notok"); ?>"> Missing
extentions: <?php print(sizeof(checkExtensions()) == 0 ? "None" : "");
foreach (checkExtensions() as $ext) {
echo $ext . ", ";
} ?> (try to install anyway)</p>
<p class="<?php print(getZipVersion() === "OK" ? "ok" : "notok"); ?>"> Zip
version: <?php echo getZipVersion(); ?> </p>
<p class="<?php print(getGitVersion() === "OK" ? "ok" : "notok"); ?>"> Git
version: <?php echo getGitVersion(); ?> </p>
<p class="<?php print(getTarVersion() === "OK" ? "ok" : "notok"); ?>"> Tar
version: <?php echo getTarVersion(); ?> </p>
<a href="?step=2"><button class="btn btn-primary">Lets go</button></a> <a href="?step=2">
</div> <button class="btn btn-primary">Lets go</button>
</div> </a>
</div>
</div>
<?php
}
if (isset($_GET['step']) && $_GET['step']==2){
?>
<div class="card card-outline card-primary">
<div class="card-header text-center">
<b class="mr-1">Controlpanel.GG</b>
</div>
<div class="card-body">
<p class="login-box-msg">Lets start with your Database</p>
<?php if(isset($_GET['message'])){
echo "<p class='notok'>".$_GET['message']."</p>";
}
?>
<form method="POST" enctype="multipart/form-data" class="mb-3"
action="/install/forms.php" name="checkDB">
<div class="row">
<div class="col-md-12">
<div class="form-group">
<div class="custom-control mb-3">
<label for="database">Database Driver</label>
<input x-model="databasedriver" id="databasedriver" name="databasedriver"
type="text" required
value="mysql" class="form-control">
</div>
</div>
<div class="form-group">
<div class="custom-control mb-3">
<label for="databasehost">Database Host</label>
<input x-model="databasehost" id="databasehost" name="databasehost" type="text"
required
value="127.0.0.1" class="form-control">
</div>
</div>
<div class="form-group">
<div class="custom-control mb-3">
<label for="databaseport">Database Port</label>
<input x-model="databaseport" id="databaseport" name="databaseport"
type="number" required
value="3306" class="form-control">
</div>
</div>
<div class="form-group">
<div class="custom-control mb-3">
<label for="databaseuser">Database User</label>
<input x-model="databaseuser" id="databaseuser" name="databaseuser" type="text"
required
value="dashboarduser" class="form-control">
</div>
</div>
<div class="form-group">
<div class="custom-control mb-3">
<label for="databaseuserpass">Database User Password</label>
<input x-model="databaseuserpass" id="databaseuserpass" name="databaseuserpass"
type="text" required
class="form-control ">
</div>
</div>
<div class="form-group">
<div class="custom-control mb-3">
<label for="database">Database</label>
<input x-model="database" id="database" name="database" type="text" required
value="dashboard" class="form-control">
</div>
</div>
</div>
<button class="btn btn-primary" name="checkDB">Submit</button>
</div>
</div>
</div>
</div>
<?php
}
if (isset($_GET['step']) && $_GET['step']==3){
?>
<div class="card card-outline card-primary">
<div class="card-header text-center">
<b class="mr-1">Controlpanel.GG</b>
</div>
<div class="card-body">
<p class="login-box-msg">Tell us something about your Host</p>
<?php if(isset($_GET['message'])){
echo "<p class='notok'>".$_GET['message']."</p>";
}
?>
<form method="POST" enctype="multipart/form-data" class="mb-3"
action="/install/forms.php" name="checkGeneral">
<div class="row">
<div class="col-md-12">
<div class="form-group">
<div class="custom-control mb-3">
<label for="database">Your Dashboard URL</label>
<input id="url" name="url"
type="text" required
value="https://dash.example.com" class="form-control">
</div>
</div>
<div class="form-group">
<div class="custom-control mb-3">
<label for="name">Your Host-Name</label>
<input id="name" name="name" type="text"
required
value="Controlpanel.gg" class="form-control">
</div>
</div>
</div>
<button class="btn btn-primary" name="checkGeneral">Submit</button>
</div>
</div>
</div>
</div>
<?php <?php
} }
if (isset($_GET['step']) && $_GET['step']==4){ if (isset($_GET['step']) && $_GET['step'] == 2) {
?> ?>
<div class="card card-outline card-primary"> <div class="card card-outline card-primary">
<div class="card-header text-center"> <div class="card-header text-center">
<b class="mr-1">Controlpanel.GG</b> <b class="mr-1">Controlpanel.GG</b>
</div> </div>
<div class="card-body"> <div class="card-body">
<p class="login-box-msg">Lets get your E-Mails going! </p> <p class="login-box-msg">Lets start with your Database</p>
<p class="login-box-msg">This might take a few seconds when submitted! </p> <?php if (isset($_GET['message'])) {
<?php if(isset($_GET['message'])){ echo "<p class='notok'>" . $_GET['message'] . "</p>";
echo "<p class='notok'>".$_GET['message']."</p>"; }
} ?>
?>
<form method="POST" enctype="multipart/form-data" class="mb-3" <form method="POST" enctype="multipart/form-data" class="mb-3"
action="/install/forms.php" name="checkSMTP"> action="/install/forms.php" name="checkDB">
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<div class="form-group"> <div class="form-group">
<div class="custom-control mb-3"> <div class="custom-control mb-3">
<label for="method">Your E-Mail method</label> <label for="database">Database Driver</label>
<input id="method" name="method" <input x-model="databasedriver" id="databasedriver" name="databasedriver"
type="text" required type="text" required
value="smtp" class="form-control"> value="mysql" class="form-control">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="custom-control mb-3"> <div class="custom-control mb-3">
<label for="host">Your Mailer-Host</label> <label for="databasehost">Database Host</label>
<input id="host" name="host" type="text" <input x-model="databasehost" id="databasehost" name="databasehost" type="text"
required required
value="smtp.google.com" class="form-control"> value="127.0.0.1" class="form-control">
</div> </div>
</div> </div>
<div class="form-group">
<div class="form-group"> <div class="custom-control mb-3">
<div class="custom-control mb-3"> <label for="databaseport">Database Port</label>
<label for="port">Your Mail Port</label> <input x-model="databaseport" id="databaseport" name="databaseport"
<input id="port" name="port" type="port" type="number" required
required value="3306" class="form-control">
value="567" class="form-control"> </div>
</div> </div>
</div> <div class="form-group">
<div class="custom-control mb-3">
<div class="form-group"> <label for="databaseuser">Database User</label>
<div class="custom-control mb-3"> <input x-model="databaseuser" id="databaseuser" name="databaseuser" type="text"
<label for="user">Your Mail User</label> required
<input id="user" name="user" type="text" value="dashboarduser" class="form-control">
required </div>
value="info@mydomain.com" class="form-control"> </div>
</div> <div class="form-group">
</div> <div class="custom-control mb-3">
<label for="databaseuserpass">Database User Password</label>
<input x-model="databaseuserpass" id="databaseuserpass" name="databaseuserpass"
<div class="form-group"> type="text" required
<div class="custom-control mb-3"> class="form-control ">
<label for="pass">Your Mail-User Password</label>
<input id="pass" name="pass" type="password"
required
value="" class="form-control">
</div>
</div>
<div class="form-group">
<div class="custom-control mb-3">
<label for="encryption">Your Mail encryption method</label>
<input id="encryption" name="encryption" type="text"
required
value="tls" class="form-control">
</div>
</div>
</div>
<button class="btn btn-primary" name="checkSMTP">Submit</button>
</div> </div>
</div> </div>
<div class="form-group">
<div class="custom-control mb-3">
<label for="database">Database</label>
<input x-model="database" id="database" name="database" type="text" required
value="dashboard" class="form-control">
</div>
</div>
</div>
<button class="btn btn-primary" name="checkDB">Submit</button>
</div> </div>
</div> </div>
</div>
</div>
<?php <?php
} }
if (isset($_GET['step']) && $_GET['step']==5){
if (isset($_GET['exec'])){
shell_exec('php artisan migrate --seed --force'); if (isset($_GET['step']) && $_GET['step'] == 3) {
}
?> ?>
<div class="card card-outline card-primary"> <div class="card card-outline card-primary">
<div class="card-header text-center"> <div class="card-header text-center">
<b class="mr-1">Controlpanel.GG</b> <b class="mr-1">Controlpanel.GG</b>
</div> </div>
<div class="card-body"> <div class="card-body">
<p class="login-box-msg">Almost done! </p> <p class="login-box-msg">Tell us something about your Host</p>
<p class="login-box-msg">Lets get some info about your Pterodactyl Installation!</p> <?php if (isset($_GET['message'])) {
<p class="login-box-msg">Before this Step make sure you ran <b>php artisan migrate --seed --force</b> in your Linux Terminal!</p> echo "<p class='notok'>" . $_GET['message'] . "</p>";
<a href="?step=5&exec"><button class="btn btn-success">You can also try to click here</button></a> }
<?php if(isset($_GET['message'])){ ?>
echo "<p class='notok'>".$_GET['message']."</p>";
}
?>
<form method="POST" enctype="multipart/form-data" class="mb-3" <form method="POST" enctype="multipart/form-data" class="mb-3"
action="/install/forms.php" name="checkPtero"> action="/install/forms.php" name="checkGeneral">
<div class="row"> <div class="row">
<div class="col-md-12"> <div class="col-md-12">
<div class="form-group"> <div class="form-group">
<div class="custom-control mb-3"> <div class="custom-control mb-3">
<label for="url">Pterodactyl URL</label> <label for="database">Your Dashboard URL</label>
<input id="url" name="url" <input id="url" name="url"
type="text" required type="text" required
value="" class="form-control"> value="https://dash.example.com" class="form-control">
</div> </div>
</div> </div>
<div class="form-group"> <div class="form-group">
<div class="custom-control mb-3"> <div class="custom-control mb-3">
<label for="key">Pterodactyl API-Key</label> <label for="name">Your Host-Name</label>
<input id="key" name="key" type="text" <input id="name" name="name" type="text"
required required
value="" class="form-control" placeholder="The Key needs ALL read&write Permissions!"> value="Controlpanel.gg" class="form-control">
</div>
</div>
</div>
<button class="btn btn-primary" name="checkPtero">Submit</button>
</div> </div>
</div> </div>
</div>
<button class="btn btn-primary" name="checkGeneral">Submit</button>
</div> </div>
</div> </div>
</div>
</div>
<?php
}
if (isset($_GET['step']) && $_GET['step'] == 4) {
?>
<div class="card card-outline card-primary">
<div class="card-header text-center">
<b class="mr-1">Controlpanel.GG</b>
</div>
<div class="card-body">
<p class="login-box-msg">Lets get your E-Mails going! </p>
<p class="login-box-msg">This might take a few seconds when submitted! </p>
<?php if (isset($_GET['message'])) {
echo "<p class='notok'>" . $_GET['message'] . "</p>";
}
?>
<form method="POST" enctype="multipart/form-data" class="mb-3"
action="/install/forms.php" name="checkSMTP">
<div class="row">
<div class="col-md-12">
<div class="form-group">
<div class="custom-control mb-3">
<label for="method">Your E-Mail method</label>
<input id="method" name="method"
type="text" required
value="smtp" class="form-control">
</div>
</div>
<div class="form-group">
<div class="custom-control mb-3">
<label for="host">Your Mailer-Host</label>
<input id="host" name="host" type="text"
required
value="smtp.google.com" class="form-control">
</div>
</div>
<div class="form-group">
<div class="custom-control mb-3">
<label for="port">Your Mail Port</label>
<input id="port" name="port" type="port"
required
value="567" class="form-control">
</div>
</div>
<div class="form-group">
<div class="custom-control mb-3">
<label for="user">Your Mail User</label>
<input id="user" name="user" type="text"
required
value="info@mydomain.com" class="form-control">
</div>
</div>
<div class="form-group">
<div class="custom-control mb-3">
<label for="pass">Your Mail-User Password</label>
<input id="pass" name="pass" type="password"
required
value="" class="form-control">
</div>
</div>
<div class="form-group">
<div class="custom-control mb-3">
<label for="encryption">Your Mail encryption method</label>
<input id="encryption" name="encryption" type="text"
required
value="tls" class="form-control">
</div>
</div>
</div>
<button class="btn btn-primary" name="checkSMTP">Submit</button>
</div>
</div>
</div>
</div>
<?php
}
if (isset($_GET['step']) && $_GET['step'] == 5) {
if (isset($_GET['exec'])) {
shell_exec('php artisan migrate --seed --force');
}
?>
<div class="card card-outline card-primary">
<div class="card-header text-center">
<b class="mr-1">Controlpanel.GG</b>
</div>
<div class="card-body">
<p class="login-box-msg">Almost done! </p>
<p class="login-box-msg">Lets get some info about your Pterodactyl Installation!</p>
<p class="login-box-msg">Before this Step make sure you ran <b>php artisan migrate --seed --force</b> in
your Linux Terminal!</p>
<a href="?step=5&exec">
<button class="btn btn-success">You can also try to click here</button>
</a>
<?php if (isset($_GET['message'])) {
echo "<p class='notok'>" . $_GET['message'] . "</p>";
}
?>
<form method="POST" enctype="multipart/form-data" class="mb-3"
action="/install/forms.php" name="checkPtero">
<div class="row">
<div class="col-md-12">
<div class="form-group">
<div class="custom-control mb-3">
<label for="url">Pterodactyl URL</label>
<input id="url" name="url"
type="text" required
value="https://ptero.example.com" class="form-control">
</div>
</div>
<div class="form-group">
<div class="custom-control mb-3">
<label for="key">Pterodactyl API-Key</label>
<input id="key" name="key" type="text"
required
value="" class="form-control"
placeholder="The Key needs ALL read&write Permissions!">
</div>
</div>
</div>
<button class="btn btn-primary" name="checkPtero">Submit</button>
</div>
</div>
</div>
</div>
<?php
}
if (isset($_GET['step']) && $_GET['step'] == 6) {
?>
<div class="card card-outline card-primary">
<div class="card-header text-center">
<b class="mr-1">Controlpanel.GG</b>
</div>
<div class="card-body">
<p class="login-box-msg">Lets create yourself!</p>
<p class="login-box-msg">We're making the first Admin user</p>
<?php if (isset($_GET['message'])) {
echo "<p class='notok'>" . $_GET['message'] . "</p>";
}
?>
<form method="POST" enctype="multipart/form-data" class="mb-3"
action="/install/forms.php" name="createUser">
<div class="row">
<div class="col-md-12">
<div class="form-group">
<div class="custom-control mb-3">
<label for="user">Your Username</label>
<input id="user" name="user"
type="text" required
value="" class="form-control">
</div>
</div>
<div class="form-group">
<div class="custom-control mb-3">
<label for="email">Your Email Adress (used to Login)</label>
<input id="email" name="email"
type="text" required
value="" class="form-control">
</div>
</div>
<div class="form-group">
<div class="custom-control mb-3">
<label for="pass">Password</label>
<input id="pass" name="pass" type="password"
required
value="" class="form-control">
</div>
</div>
<div class="form-group">
<div class="custom-control mb-3">
<label for="repass">Retype Pass</label>
<input id="repass" name="repass" type="password"
required
value="" class="form-control">
</div>
</div>
<div class="form-group">
<div class="custom-control mb-3">
<label for="repass">Your Pterodactyl User-ID</label>
<input id="pteroID" name="pteroID" type="text"
required
value="" class="form-control">
</div>
</div>
</div>
<button class="btn btn-primary" name="createUser">Submit</button>
</div>
</div>
</div>
</div>
<?php
}
if (isset($_GET['step']) && $_GET['step'] == 7) {
?>
<div class="card card-outline card-primary">
<div class="card-header text-center">
<b class="mr-1">Controlpanel.GG</b>
</div>
<div class="card-body">
<p class="login-box-msg">All done!</p>
<p class="login-box-msg">You may navigate to your Dashboard now and log in!</p>
<a href="<?php echo "https://" . $_SERVER['SERVER_NAME']; ?>">
<button class="btn btn-success">Lets go!</button>
</a>
</div>
</div>
</div>
<?php <?php
} }
?> ?>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script> integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p"
</body> crossorigin="anonymous"></script>
</html> </body>
</html>