Lecteur Markdown
GUESTBOOK_DOCUMENTATION_EN
BeamReactor — Module `guestbook` #
Version: 5.2.0
Author: Treveur Bretaudière
Since: 2002
Last updated: 2026-02-11
---
Overview #
The `guestbook` module is a guestbook allowing users to leave public messages. It includes moderation, anti-flood protection, input validation and pagination.
---
Requirements #
- The `guestbook` table must exist in the database (checked via `sql_table_exists()`).
- `GUESTBOOK_LEVEL_USER` access level to post.
- `GUESTBOOK_LEVEL_MODERATOR` access level to delete.
- `Beamreactor\Database\SQL` and `Beamreactor\Sanitizer\Parser` classes.
---
Data Table #
Table: `guestbook`
| Field | Description |
|---|---|
| `id` | Unique identifier (auto-increment) |
| `name` | Author name |
| `email` | Email address |
| `website` | Website (optional) |
| `country` | Country (selected from a static list) |
| `message` | Message content |
| `time` | Publication date |
| `ip` | IP address (via `ipCheck()`) |
---
Behaviour #
Anti-flood #
Before any processing, the module checks the last entry from the same IP. If fewer than 10 seconds have elapsed, a message is displayed and the module returns.
Deletion (moderation) #
A user with `GUESTBOOK_LEVEL_MODERATOR` can delete an entry via the GET parameter `gbdelentry`. JavaScript confirmation on the client side.
Adding a Message #
The form is displayed if the user has `GUESTBOOK_LEVEL_USER` level. The add action is triggered when the submit matches `$dialgb[16]`.
| Field | Validation |
|---|---|
| `name` | Required, `Parser::sanitize($str, 'string', maxLength: 40)` |
| `email` | Required, sanitised via `Parser::sanitize($str, 'email')`, validated via `Parser::check()` |
| `website` | Optional, `Parser::sanitize($str, 'string', maxLength: 120)`, `'none'` treated as empty |
| `country` | Required, must differ from the select default value (`$dialgb[6]`) |
| `message` | Required, minimum 10 characters, `Parser::sanitize($str, 'string', maxLength: 1000)` |
The form pre-fills the email from the session and retains entered values on error.
Message Display #
Messages displayed in descending ID order, 10 per page. Each entry shows the name, website link (if present, prefixed `http://`), country, date and message. The `[X]` deletion link only appears for moderators.
Pagination #
GET parameter `gbpage`. Previous/next navigation.
---
Country List #
The module includes a static list of approximately 250 countries/territories in a PHP `$countries` array, including some non-standard entries (Armor Breizh, Catalunya, Corsica, Scotland, the oceans).
---
Configuration #
| Constant | Role |
|---|---|
| `GUESTBOOK_LEVEL_USER` | Minimum level to post |
| `GUESTBOOK_LEVEL_MODERATOR` | Minimum level to delete |