getConf(); $json = json_decode(file_get_contents($config["PATH"] . "/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 getDB() { $config = $this->getConf(); $db = new PDO("sqlite:" . $config["DB_PATH"]); $db->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION); return $db; } public function generateSessionID() { $num = rand(1, 999999); $hash = hash("sha256", $num); return $hash; } }