diff --git a/api/setup/setup.php b/api/setup/setup.php index a17553f..aa1a4c1 100644 --- a/api/setup/setup.php +++ b/api/setup/setup.php @@ -50,8 +50,14 @@ $device_id = rand(1, 999); $json[$device_id] = json_encode($session); $json["array"] = true; +mkdir($config["PATH"] . "/tmp/user_sessions", 0700, true); + file_put_contents($config["PATH"] . "/tmp/user_sessions/" . $admin_user . ".json", json_encode($json)); +setcookie("session_id", $session); +setcookie("device_id", $device_id); +setcookie("username", $admin_user); + header("Location: /"); exit; ?> \ No newline at end of file diff --git a/front/css/setup.css b/front/css/setup.css index e219046..3733901 100644 --- a/front/css/setup.css +++ b/front/css/setup.css @@ -14,7 +14,10 @@ body { 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; + background: rgba(255, 255, 255, 0.3); + backdrop-filtbackground: rgba(255, 255, 255, 0.3); + backdrop-filter: blur(5px); + -webkit-backdrop-filter: blur(5px); display: grid; place-items: center; transition: all 0.3s ease-in-out; @@ -53,10 +56,15 @@ input { height: 30px; border-radius: 10pt; padding: 5px; + background: rgba(255, 255, 255, 0.3); + backdrop-filter: blur(5px); + -webkit-backdrop-filter: blur(5px); } input:focus { - outline: 2px solid #000000; + backdrop-filter: blur(10px); + -webkit-backdrop-filter: blur(10pxr); + outline: none; } button { diff --git a/front/index.php b/front/index.php index 9255bf0..8417fa8 100644 --- a/front/index.php +++ b/front/index.php @@ -7,7 +7,7 @@ | | | | | | (__ ____) | __/ | \ V /| |___| (_) | | | | |_| | | (_) | | |_| |_| |_|\___|_____/ \___|_| \_/ \_____\___/|_| |_|\__|_| \___/|_| -* By RootMarc +* By marc-go */ require "../main.php"; @@ -20,5 +20,8 @@ if (!$mcServ->checkConf()) { } if (!$mcServ->checkLogin()) { - + header("Location: /admin"); + exit; +}else{ + echo "true"; } \ No newline at end of file diff --git a/front/login.php b/front/login.php new file mode 100644 index 0000000..e69de29 diff --git a/main.php b/main.php index 4ac6e8c..843a430 100644 --- a/main.php +++ b/main.php @@ -7,7 +7,7 @@ | | | | | | (__ ____) | __/ | \ V /| |___| (_) | | | | |_| | | (_) | | |_| |_| |_|\___|_____/ \___|_| \_/ \_____\___/|_| |_|\__|_| \___/|_| -* By RootMarc +* By marc-go */ class mcServ { @@ -24,9 +24,23 @@ class mcServ { } public function checkLogin() { - if (!isset($_COOKIE["session_id"]) || !isset($_COOKIE["user_id"])) { + if (!isset($_COOKIE["session_id"]) || !isset($_COOKIE["device_id"])) { return false; } + + $json = json_decode(file_get_contents(this->getConf() . "/tmp/user_sessions/" . $_COOKIE["username"] . ".json"), true); + + if (!isset($json[$_COOKIE["device_id"]])) { + return false; + } + + $device = json_decode($json[$_COOKIE["device_id"]], true); + + if ($device["session_id"] !== $_COOKIE["session_id"]) { + return false; + } + + return true; } public function generateSessionID() { diff --git a/mcServ.db b/mcServ.db index 2a1303c..d58b0ed 100644 Binary files a/mcServ.db and b/mcServ.db differ