Begin Setup
This commit is contained in:
25
api/setup/setup.php
Normal file
25
api/setup/setup.php
Normal file
@@ -0,0 +1,25 @@
|
||||
<?php
|
||||
$admin_user = $_GET["admin_user"];
|
||||
$admin_mail = $_GET["admin_mail"];
|
||||
$admin_passwd_1 = $_GET["admin_passwd_1"];
|
||||
$admin_passwd_2 = $_GET["admin_passwd_2"];
|
||||
|
||||
if (!isset($admin_user) || !isset($admin_mail) || !isset($admin_passwd_1) || !isset($admin_passwd_2)) {
|
||||
die('{"status":500, "error":"Missing fields"}');
|
||||
}
|
||||
|
||||
if ($admin_passwd_2 !== $admin_passwd_1) {
|
||||
die('{"status":500, "error":"Passwords do not match"}');
|
||||
}
|
||||
|
||||
$db = new PDO("sqlite:mcserv.db");
|
||||
$db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
|
||||
|
||||
$sql = "
|
||||
CREATE TABLE IF NOT EXISTS users (
|
||||
id INT(11) PRIMARY KEY AUTOINCREMENT,
|
||||
username VARCHAR(30) PRIMARY KEY,
|
||||
mail VARCHAR(50),
|
||||
passwd VARCHAR(100)
|
||||
)
|
||||
";
|
||||
81
front/css/setup.css
Normal file
81
front/css/setup.css
Normal file
@@ -0,0 +1,81 @@
|
||||
body {
|
||||
font-family: system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, 'Open Sans', 'Helvetica Neue', sans-serif;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
height: 100vh;
|
||||
overflow: hidden;
|
||||
background-color: #fafafa;
|
||||
}
|
||||
|
||||
.page-content {
|
||||
padding: 10px;
|
||||
width: 350px;
|
||||
height: 625px;
|
||||
text-align: center;
|
||||
box-shadow: 0 2px 100px rgba(0, 0, 0, 0.1), 0 8px 16px rgba(0, 0, 0, 0.1);
|
||||
border-radius: 30pt;
|
||||
background-color: #ffffff;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
transition: all 0.3s ease-in-out;
|
||||
}
|
||||
|
||||
.page {
|
||||
display: flex;
|
||||
flex-direction: column;
|
||||
align-items: center;
|
||||
text-align: center;
|
||||
gap: 10px;
|
||||
transition: all 0.3s ease-in-out;
|
||||
}
|
||||
|
||||
.header {
|
||||
position: relative;
|
||||
top: 10px;
|
||||
bottom: 10px;
|
||||
}
|
||||
|
||||
#control {
|
||||
display: none;
|
||||
}
|
||||
|
||||
h1 {
|
||||
font-size: 30pt;
|
||||
}
|
||||
|
||||
h2 {
|
||||
font-size: 20pt;
|
||||
}
|
||||
|
||||
input {
|
||||
border: 1px solid #e0e0e0;
|
||||
width: 200px;
|
||||
height: 30px;
|
||||
border-radius: 10pt;
|
||||
padding: 5px;
|
||||
}
|
||||
|
||||
input:focus {
|
||||
outline: 2px solid #000000;
|
||||
}
|
||||
|
||||
button {
|
||||
margin-bottom: 10px;
|
||||
width: 100px;
|
||||
height: 30px;
|
||||
background-color: #000000;
|
||||
color: #ffffff;
|
||||
display: grid;
|
||||
place-items: center;
|
||||
text-align: center;
|
||||
border: none;
|
||||
transition: all 0.3s ease-in-out;
|
||||
}
|
||||
|
||||
button:hover {
|
||||
transform: scale(1.1);
|
||||
}
|
||||
|
||||
button:active {
|
||||
transform: scale(0.8);
|
||||
}
|
||||
@@ -10,10 +10,9 @@
|
||||
* By RootMarc
|
||||
*/
|
||||
|
||||
|
||||
require "main.php";
|
||||
|
||||
$mcServ = new mgServ();
|
||||
$mcServ = new mcServ();
|
||||
|
||||
if (!$mcServ->checkConf()) {
|
||||
header("Location: /setup.html");
|
||||
|
||||
@@ -4,8 +4,29 @@
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>mgServ // Setup</title>
|
||||
<link rel="stylesheet" type="text/css" href="css/setup.css">
|
||||
</head>
|
||||
<body>
|
||||
<div class=""
|
||||
<div class="page-content" id="block">
|
||||
<div class="header">
|
||||
<h1>mcServControl</h1>
|
||||
<h2>Setup</h2>
|
||||
</div>
|
||||
<div class="content">
|
||||
<form action="/api/setup/setup.php" method="post">
|
||||
<div id="admin_user" class="page">
|
||||
<h3>Admin User</h3>
|
||||
<p>Create an Admin User</p>
|
||||
|
||||
<input type="text" name="admin_user" placeholder="Username" id="admin_user" required><br><br>
|
||||
<input type="mail" name="admin_mail" placeholder="E-Mail Address" id="admin_mail" required><br><br>
|
||||
<input type="password" name="admin_passwd_1" placeholder="Password" id="admin_passwd_1"><br><br>
|
||||
<input type="password" name="admin_passwd_2" placeholder="Repet Password" id="admin_passwd_2" required><br><br>
|
||||
|
||||
<button type="submit">Finish</button>
|
||||
</div>
|
||||
</form>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user