37 lines
1.7 KiB
Markdown
37 lines
1.7 KiB
Markdown
|
# guestbook.php
|
||
|
|
||
|
This is a drop-in guestbook system using PHP and SQLite3, meant to be simple enough to fit into one file and be configurable by hand with ease.
|
||
|
|
||
|
## Setup
|
||
|
|
||
|
Assuming you have PHP installed on your server, setting up this guestbook should be as easy as dropping `guestbook.php` into a folder. It will create the database and necessary tables on the first load. If it doesn't work immediately it's probably a bug and I'd encourage you to reach out to me about it.
|
||
|
|
||
|
[Have the latest version of PHP installed][1], and make sure you have SQLite3 set up as well. On Debian, if you don't have `php-8.2-sqlite3` installed, you can install it by running:
|
||
|
|
||
|
```
|
||
|
$ sudo apt install php8.2-sqlite3
|
||
|
```
|
||
|
|
||
|
I've tested this using PHP 8.2. It seems like the Debian package `php8.3-sqlite3` so some additional setup may be required to get it working with PHP 8.3 if you're on Debian.
|
||
|
|
||
|
## Configuring
|
||
|
|
||
|
Several constants are defined using the PHP `define` function, which works as follows:
|
||
|
|
||
|
```php
|
||
|
define('[name of constant]', [PHP expression]);
|
||
|
```
|
||
|
|
||
|
You can change these constants according to your need. You can also search the file for references to them to see where they're used.
|
||
|
|
||
|
Beneath the PHP script at the top of the file, there's the complete HTML page for the guestbook, including the style sheet in the head tag, that you can adjust to your needs.
|
||
|
|
||
|
[1]: https://www.php.net/manual/en/install.php
|
||
|
|
||
|
## "License"
|
||
|
|
||
|
This software is a gift from me to you. By accepting this gift, we're forming a relationship, and with that comes certain expectations. Namely:
|
||
|
|
||
|
* When you share this gift with others, you will share it in the same spirit as I share it with you.
|
||
|
* You will not use this gift to hurt people, any living creatures, or the planet
|