".swf", // You can add more here if you REALLY want to ]; if (!is_dir($uploadDir)) mkdir($uploadDir, 0775, true); if (!file_exists($dataFile)) file_put_contents($dataFile, json_encode([])); function loadPosts() { global $dataFile; return json_decode(file_get_contents($dataFile), true) ?: []; } function savePosts($posts) { global $dataFile; file_put_contents($dataFile, json_encode($posts, JSON_PRETTY_PRINT)); generateHTML(); } function h($str) { return htmlspecialchars($str, ENT_QUOTES, "UTF-8"); } function generateHTML() { $posts = array_reverse(loadPosts()); $html = '
No. | Name | File | Tag | Subject | Size | Date | Replies |
---|---|---|---|---|---|---|---|
' . h($p["id"]) . ' | ' . h($p["name"]) . ' | '; if ($p["file"]) { $html .= '[Embed]'; } else { $html .= '—'; } $html .= ' | [' . h($p["tag"]) . '] | ' . h($p["subject"]) . ' | ' . ($p["size"] ? round($p["size"]/1024,2) . " KB" : "—") . ' | ' . h($p["date"]) . ' | ' . count($p["replies"]) . ' [Reply] |
';
foreach ($p["replies"] as $r) {
$html .= ' ▶ ' . h($r["text"]) . ' (' . h($r["date"]) . ') ';
}
$html .= ' | |||||||