|
|
@@ -94,13 +94,13 @@ $app->map(['GET', 'POST'], '/blog/create', function (Request $request, Response |
|
|
|
addFooter($response); |
|
|
|
} else { |
|
|
|
$data = $request->getParsedBody(); |
|
|
|
$db = new Blog(); |
|
|
|
$blog = new Blog(); |
|
|
|
|
|
|
|
$res = $db->createBlog($data); |
|
|
|
$res = $blog->createBlog($data); |
|
|
|
if ($res) { |
|
|
|
return $response->withHeader('Location', '/')->withStatus(302); |
|
|
|
} else { |
|
|
|
$err = $db->lastErrorMsg(); |
|
|
|
$err = $blog->lastErrorMsg(); |
|
|
|
$_SESSION['error'] = $err; |
|
|
|
return $response->withHeader('Location', '/blog/create')->withStatus(302); |
|
|
|
} |
|
|
@@ -148,8 +148,8 @@ $app->map(['GET', 'POST'], '/login', function (Request $request, Response $respo |
|
|
|
} else { |
|
|
|
$postdata = $request->getParsedBody(); |
|
|
|
|
|
|
|
$db = new User(); |
|
|
|
$logged_in = $db->checkUserPass($postdata['username'], $postdata['password']); |
|
|
|
$user = new User(); |
|
|
|
$logged_in = $user->checkUserPass($postdata['username'], $postdata['password']); |
|
|
|
if ($logged_in) { |
|
|
|
//if ($postdata['username'] == 'gebruiker' && $postdata['password'] == "abcd") { |
|
|
|
$_SESSION["username"] = $postdata['username']; |