$_POST['content'], 'timestamp' => time() ]; file_put_contents(DATA_FILE, json_encode($pastes)); header("Location: " . BASE_URL . "?id=$id"); exit; } } elseif (isset($_GET['delete']) && isset($_GET['id'])) { $id = $_GET['id']; if (isset($pastes[$id])) { unset($pastes[$id]); file_put_contents(DATA_FILE, json_encode($pastes)); header("Location: " . BASE_URL); exit; } } if (isset($_GET['id'])) { $id = $_GET['id']; if (isset($pastes[$id])) { echo "
" . htmlspecialchars($pastes[$id]['content']) . ""; echo "Create new paste | "; echo "Delete this paste"; exit; } else { echo "Paste not found."; exit; } } ?>