I'm looking to build a website where users can submit text that the next visitor will see. It would work similar to a web version of Moirai. What's the best way to accomplish this? Do I need a database or can I use a simpler method?
4 Answers
Think about what happens if multiple users submit text at the same time. All those users might see the same text if the process isn't handled correctly. You could write to a file instead of setting up a database, but you'll still need a method to manage the submissions securely.
If you get this working, remember to implement some security measures! It's crucial to disable links in the text and have some form of bot protection to prevent misuse.
You should keep a single record in a persistent database and allow new submissions to overwrite whatever was previously there. This way, only the latest submission will be displayed.
To start, you'll want to add submitted text to a persistent database. While using a server-side language like PHP to create a `.txt` file might be the easiest way, it's not the best practice. When visitors submit text via a `POST` form, PHP can read from this file and display the content. However, if you're serious about your site, consider using a more robust database system as your traffic grows.

Related Questions
How to Build a Custom GPT Journalist That Posts Directly to WordPress
Cloudflare Origin SSL Certificate Setup Guide
How To Effectively Monetize A Site With Ads