Update repo meta files

This commit is contained in:
Nat 2024-03-10 10:47:38 -07:00
parent 33bb79a095
commit 12171ecba7
Signed by: nat
GPG Key ID: B53AB05285D710D6
2 changed files with 23 additions and 4 deletions

View File

@ -1,6 +1,6 @@
# guestbook.php # 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. This is a guestbook system for personal websites! Its gimick is that it's simple enough to fit in one file (the SQLite database is technically another file, but `guestbook.php` will generate and handle it all on its own).
## Setup ## Setup
@ -12,22 +12,41 @@ Assuming you have PHP installed on your server, setting up this guestbook should
$ sudo apt install php8.2-sqlite3 $ 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. I've tested this using PHP 8.2. It seems like the Debian package `php8.3-sqlite3` is still experimental as of writing (2024-03-10) so some additional setup may be required to get it working with PHP 8.3 if you're on Debian.
If you just want to test it out without installing something like Nginx, you can use some built in PHP utilities to run a simple server. Run this in the directory where you downloaded `guestbook.php`
```
php -S localhost:8080
```
Then, navigate to `http://localhost:8080/guestbook.php` in your browser.
## Configuring ## Configuring
Several constants are defined using the PHP `define` function, which works as follows: Several constants are defined at the very top of `guestbook.php` using the PHP `define` function, which works as follows:
```php ```php
define('[name of constant]', [PHP expression]); 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. 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:
* `GUESTBOOK_NAME` - The name of your guestbook! Used as the page title
* `GUESTBOOK_PAGE_SIZE` - The maximum number of guestbook entries to display on a single page. Additional entries will be moved to the next page, reachable by clicking the navigation buttons at the bottom of the document
* `GUESTBOOK_RATE_LIMIT_SECONDS` - The number of seconds between allowable submissions to the guestbook (i.e. for a rate limit of N seconds, users can only publish an entry every N seconds). Used as a spam prevention mechanism.
* `GUESTBOOK_SQLITE_LOCATION` - The location of the database. If the database isn't found at the location, a new one will be created. Make sure your server has the ability to write to this location!
* `CHALLENGE_QUESTION` - An additional question added to the form as a spam prevention mechanism. The default is "What month is it?" which will trip up LLM-enabled spam bots 11 out of 12 times. If a user doesn't answer correctly, their submission will be quietly ignored
* `CHALLENGE_ANSWER_REGEX` - A regex matching all correct answers to the challenge question
* `SHADOWBAN_REGEX` - If any of the fields (except the challenge question) match this regex, they will be quietly ignored. You may want to use this to block certain keywords you don't want showing up in your guestbook.
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. 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 [1]: https://www.php.net/manual/en/install.php
## Screenshots
![A screenshot of the guestbook. The header reads "Sign the guestbook". Beneath it, a smaller notice indicates that the user has successfully submitted an entry. A boxed form allows the user to input their name, website and message, along with an answer to a challenge question. Below the box, guestbook entries are listed. At the very bottom, a privacy statement describes how the user's IP address is stored as a hash to prevent spam](meta/screenshot.jpg)
## "License" ## "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: 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:

BIN
meta/screenshot.jpg Normal file

Binary file not shown.

After

Width:  |  Height:  |  Size: 42 KiB