|
|
@@ -55,8 +55,10 @@ $app->get('/blog/{slug}', function (Request $request, Response $response, array |
|
|
|
}); |
|
|
|
|
|
|
|
$app->get('/logout', function(Request $request, Response $response, array $args) { |
|
|
|
|
|
|
|
unset($_SESSION['username']); |
|
|
|
addNavbar($response); |
|
|
|
$response->getBody()->write('logged out'); |
|
|
|
addFooter($response); |
|
|
|
return $response; |
|
|
|
}); |
|
|
|
|
|
|
@@ -73,8 +75,11 @@ $app->map(['GET', 'POST'],'/login', function (Request $request, Response $respon |
|
|
|
} else { |
|
|
|
$postdata = $request->getParsedBody(); |
|
|
|
if ($postdata['username'] == 'gebruiker' && $postdata['password'] == 'abcd') { |
|
|
|
$response->getBody()->write('logged in'); |
|
|
|
$_SESSION['username'] = $postdata['username']; |
|
|
|
addNavbar($response); |
|
|
|
$response->getBody()->write('logged in'); |
|
|
|
addFooter($response); |
|
|
|
|
|
|
|
} else { |
|
|
|
$response->getBody()->write('username and/or password incorrect'); |
|
|
|
} |