Fix bugs
This commit is contained in:
11
main.php
Normal file → Executable file
11
main.php
Normal file → Executable 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;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user