|
|
@@ -105,12 +105,8 @@ $app->map(['GET', 'POST'], '/blog/create', function (Request $request, Response |
|
|
|
} else { |
|
|
|
$data = $request->getParsedBody(); |
|
|
|
global $db; |
|
|
|
$stmt = $db->prepare("INSERT INTO blogs (slug, title, content) VALUES (:slug, :title, :content)"); |
|
|
|
$stmt->bindValue(':slug', $data['slug'], SQLITE3_TEXT); |
|
|
|
$stmt->bindValue(':title', $data['title'], SQLITE3_TEXT); |
|
|
|
$stmt->bindValue(':content', $data['content'], SQLITE3_TEXT); |
|
|
|
$res = $stmt->execute(); |
|
|
|
|
|
|
|
$res = $db->createBlog($data); |
|
|
|
if($res) { |
|
|
|
return $response->withHeader('Location', '/')->withStatus(302); |
|
|
|
} else { |