$tmp) {
if ($_FILES[‘images’][‘error’][$i] === 0) {
$ext = pathinfo($_FILES[‘images’][‘name’][$i], PATHINFO_EXTENSION);
$name = uniqid(“img_”) . “.” . $ext;
move_uploaded_file($tmp, $UPLOAD_DIR . $name);
$images[] = “uploads/” . $name;
}
}
}
$posts[] = [
“title” => htmlspecialchars($_POST[’title’]),
“content” => nl2br(htmlspecialchars($_POST[‘content’])),
“images” => $images,
“date” => date(“d-m-Y H:i”)
];
file_put_contents($POSTS_FILE, json_encode($posts, JSON_PRETTY_PRINT));
header(“Location: ” . $_SERVER[‘REQUEST_URI’]);
exit;
}
$posts = json_decode(file_get_contents($POSTS_FILE), true);
?>
🔒 Privé Blog
Nieuwe post
Blog posts
Nog geen posts.
= $post['title'] ?>
= $post['date'] ?>
= $post['content'] ?>