Add login
This commit is contained in:
18
main.php
18
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() {
|
||||
|
||||
Reference in New Issue
Block a user