Hey everyone,
I’m trying to set up a guestbook for my Xisto-hosted site. I found an old tutorial that used CGI scripts, but after banging my head against the wall for hours, I realized that approach is pretty outdated. Nowadays, a simple PHP/MySQL solution is way more practical and easier to manage.
I’ve got cPanel access through Xisto and I’ve already created a MySQL database. My plan is to write a PHP script that stores guestbook entries in a database using PDO (for security). I want to include a simple form where visitors can leave their name, email (optional), website, and message. The entries should be displayed in reverse chronological order.
I’ve got the basics down, but I’m stuck on a few things:
- How do I securely connect to the database and prevent SQL injection? (I’ve read about prepared statements, but I’m not sure if I’m using them right.)
- Should I use sessions to avoid duplicate submissions? Or just rely on timestamp checks?
- For the display page, should I paginate results or just show the last 50 entries?
Also, I’m not sure about the best file structure within my Xisto public_html folder. Do I put the PHP files directly in the root, or should I create a subfolder like /guestbook/ ?
If anyone has a working PHP guestbook script they’d be willing to share (or point me to a good tutorial), I’d really appreciate it. I’m hoping to make this a learning project, so even just hints would help!
Thanks! Nani
