diff --git a/BancaDati/BancaDati.php b/BancaDati/BancaDati.php index 790d024..0ad19f9 100644 --- a/BancaDati/BancaDati.php +++ b/BancaDati/BancaDati.php @@ -120,6 +120,7 @@ class BancaDati { try { return $this->pdo->query($sql)->fetch(); }catch (PDOException $e){ + var_dump($e); die; } } diff --git a/index.php b/index.php index 756988a..374358d 100644 --- a/index.php +++ b/index.php @@ -14,16 +14,16 @@ $db = new BancaDati(); $app->use("/", function (array &$req, Response $res) { if(isset($_COOKIE["TOKEN"])){ - // user mit token finden und im req übergeben $user = new User(); - $user->loginWithToken($_COOKIE["TOKEN"]); - $req["user"] = $user; + if($user->loginWithToken($_COOKIE["TOKEN"])){ + $req["user"] = $user; + } } }); $app->get("/", function (array $req, Response $res) { $res->send("Hello World"); - var_dump($req["user"]); + //var_dump($req["user"]); }); $app->get("/user", function (array $req, Response $res) {