diff --git a/index.php b/index.php new file mode 100755 index 0000000..d581220 --- /dev/null +++ b/index.php @@ -0,0 +1,67 @@ + $_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 "

paste $id

"; + echo "
" . htmlspecialchars($pastes[$id]['content']) . "
"; + echo "Create new paste | "; + echo "Delete this paste"; + exit; + } else { + echo "Paste not found."; + exit; + } +} + +?> + + + + + pastry + + +

new paste

+
+
+ +
+ +

recent pastes

+ + + diff --git a/pastes.json b/pastes.json new file mode 100755 index 0000000..e69de29