This commit is contained in:
2026-02-14 21:30:57 +01:00
parent e12ad0ad7e
commit 6dee5a73f5
13 changed files with 135 additions and 10 deletions

11
main.php Normal file → Executable file
View File

@@ -10,6 +10,10 @@
* By marc-go
*/
ini_set("display_errors", 1);
ini_set("display_startup_errors", 1);
error_reporting(E_ALL);
class mcServ {
public function checkConf() {
if (!file_exists("../mcServ.db")) {
@@ -25,18 +29,23 @@ class mcServ {
public function checkLogin() {
if (!isset($_COOKIE["session_id"]) || !isset($_COOKIE["device_id"])) {
echo "Keine Cookies gesetzt";
return false;
}
$json = json_decode(file_get_contents(this->getConf() . "/tmp/user_sessions/" . $_COOKIE["username"] . ".json"), true);
$config = $this->getConf();
$json = json_decode(file_get_contents($config["PATH"] . "/tmp/user_sessions/" . $_COOKIE["username"] . ".json"), true);
if (!isset($json[$_COOKIE["device_id"]])) {
echo "Device ID gibt es nicht im JSON";
return false;
}
$device = json_decode($json[$_COOKIE["device_id"]], true);
if ($device["session_id"] !== $_COOKIE["session_id"]) {
echo "Session IDs stimmen nicht überein";
return false;
}