# ZnoteX

**A complete website for your Open Tibia server.**
Version 2.0.5 · Maintained by [Open Games Community](https://opengamescommunity.com)
[Website](https://opengamescommunity.com) · [Source & releases](https://github.com/Open-Games-Community/ZnoteX) · [Themes](layouts/README.md) · [Plugins](plugins/README.md)
[](https://www.codefactor.io/repository/github/open-games-community/znotex/overview/main)
[](https://github.com/Open-Games-Community/ZnoteX/actions/workflows/php-compatibility.yml)
---
## About
ZnoteX is a full automatic account creator (AAC) and website for Open Tibia servers — account
registration, character management, highscores, guilds, houses, a forum, a shop and an admin panel,
all in one package. It is written in PHP with a simple procedural framework, so it is easy to read
and easy to modify.
The original ZnoteX went unmaintained for roughly five years. This repository picks the project
back up rather than starting over — we think it is the strongest foundation among the available
Open Tibia AAC projects, and we intend to keep building on it.
---
## Requirements
| | |
| --- | --- |
| **PHP** | 8.1 or newer — 8.1, 8.2, 8.3, 8.4 and 8.5 all supported |
| **Database** | MySQL or MariaDB |
| **Required extension** | `mysqli` |
| **Optional extensions** | `curl` (PayPal, reCaptcha, e-mail) · `openssl` (reCaptcha) · `gd` (guild images) · `apcu` (memory cache) |
> PHP 8.0 and older are **not** supported and will be refused at startup.
**Optional:** for e-mail verification and account recovery, download
[PHPMailer 6.x](https://github.com/PHPMailer/PHPMailer/releases) and extract it into the ZnoteX
directory as a folder named `PHPMailer`.
---
## Supported servers
Set `$config['ServerEngine']` in `config.php` to match your server:
| Server | `ServerEngine` |
| --- | --- |
| TFS 1.6 | `TFS_16` |
| TFS 1.1 – 1.4.2 | `TFS_10` |
| Canary / OTServBR-Global | `CANARY` |
| TFS 0.3.6+ / 0.4 / OTX | `TFS_03` |
| TFS 0.2.13+ | `TFS_02` |
| OTHire | `OTHIRE` |
TFS 1.0 is not supported.
**Canary notes** — two-factor authentication is unavailable (Canary's account table has nowhere to
store it), and the shop uses Znote's own points system rather than Canary coins.
---
## Web server stacks
You need Apache (or nginx) + PHP 8.1+ + MySQL/MariaDB. On Windows, any of these bundles work — just
make sure you grab a build that ships **PHP 8.1 or newer**.
| Stack | Download | Why pick it |
| --- | --- | --- |
| **Uniform Server** (UniServerZ) | [uniformserver.com](https://www.uniformserver.com/) · [SourceForge](https://sourceforge.net/projects/miniserver/) | Portable and very light on resources. No installer — unzip and run, easy to move or back up. A great default for a home-hosted server. |
| **XAMPP** | [apachefriends.org](https://www.apachefriends.org/) | The most popular and the easiest to set up. Includes phpMyAdmin. Changing PHP version means installing a different XAMPP build. |
| **WampServer** | [wampserver.com](https://www.wampserver.com/) | The fastest of the three, and you can switch PHP/MySQL versions from the tray icon. **Heavy on RAM** — MySQL has been seen using 5 GB+. Only worth it if the machine has memory to spare. |
On a Linux VPS or shared hosting you do not need any of these. Just set the hosting panel to PHP 8.1
or newer (8.3 / 8.4 recommended).
---
## Installation
### Docker (fastest way to try it)
```
git clone https://github.com/Open-Games-Community/ZnoteX.git
cd ZnoteX
cp .env.example .env
docker compose up -d
```
That's it — open **http://localhost:8080**. The stack brings up:
| Service | What it's for | Default URL |
| --- | --- | --- |
| **znotex** | PHP 8.5 + Apache, ZnoteX itself, Composer dependencies already installed | http://localhost:8080 |
| **db** | MySQL 8.4, pre-loaded with a demo game schema matching `ZNOTE_SERVER_ENGINE` | localhost:3306 |
| **phpmyadmin** | Browse the database | http://localhost:8081 |
| **mailpit** | Every outgoing e-mail (registration, recovery, etc.) is caught here instead of actually sending | http://localhost:8025 |
`ZNOTE_SERVER_ENGINE` in `.env` picks which game database gets imported on first boot, matching
the same six choices the installer offers:
| Value | Engine | Demo accounts/characters? |
| --- | --- | --- |
| `TFS_10` (default) | TFS 1.1 - 1.4.2 | Yes - account **`demo`** / password **`demo123`** already has admin panel access, with 3 demo characters |
| `TFS_16` | TFS 1.6 | Schema only |
| `CANARY` | Canary / OTServBR-Global | Schema only |
| `TFS_03` | TFS 0.3.6+ / 0.4 / OTX | Schema only |
| `TFS_02` | TFS 0.2.13+ | Falls back to the TFS_03 schema - no dedicated 0.2.x schema is bundled |
| `OTHIRE` | OTHire | Schema only |
Set it in `.env` **before** the first `docker compose up -d` — the schema is only imported once,
into a fresh database volume. To switch engines afterward, `docker compose down -v` (this wipes
the database) and start again. `config.local.php` is generated automatically from
`docker-compose.yml`'s environment values on every container start — edit those instead of the
file itself. Change ports or credentials in `.env` before the first start if the defaults collide
with something else on your machine.
This environment is for trying ZnoteX or developing on it — every bundled game schema is a demo,
not a real Tibia server. Point `ZNOTE_DB_*` at your actual server's database for production use.
### The installer
Extract ZnoteX into your web directory and open **`/install/`** in a browser. Six steps:
| | |
| --- | --- |
| **1. Requirements** | PHP version, `mysqli`, and whether `engine/cache/` is writable |
| **2. Database** | Credentials, and a check that your **OT server's own schema is already imported** |
| **3. Server** | Which engine this site sits in front of, the site name and its URL |
| **4. Schema** | Imports `SQL/znote_schema.sql` — only the `znote_*` tables |
| **5. Administrator** | Creates an account and a character, and remembers the name |
| **6. Finish** | Writes `config.local.php` and locks the installer |
**Import your OT server's schema first.** ZnoteX reads `accounts` and `players`; it has never
created them and will not pretend to. Step 2 refuses to continue until they exist — importing
TFS/Canary's own `schema.sql` afterwards would overwrite what the installer is about to write.
Step 5 creates a real, working administrator: the account, a character on it, and the password
hashed the way `login.php` expects on your engine. Step 6 puts that **account name** in
`page_admin_access`, so you can reach `/admin/` the moment the installer finishes. It writes to
**`config.local.php`**, not `config.php` — see below — though a checkbox on the last step will
write the admin name into `config.php` instead if you prefer.
When it is done, **delete the `install/` folder**. It refuses to run again on its own (step 6
leaves a lock file), but there is no reason to leave it on a public server.
### config.php and config.local.php
`config.php` holds every default and every comment. `config.local.php` holds only what is
specific to *this* install — database credentials, engine, site name, admin names — and is
included last, so it wins.
That split is what makes updating painless: a new ZnoteX release can ship a new `config.php`
without touching your settings. **Keep `config.local.php` out of version control.**
Most other settings are editable from **Admin Panel → Settings** without opening a file at all.
### Installing by hand
If you would rather not use the installer, or it cannot write the config file:
1. Import your OT server's schema, then `SQL/znote_schema.sql`, into the same database.
2. Create `config.local.php` next to `config.php`:
```php
true`, so a fresh install without APCu stops on every cached
page with *"Configuration error! APCu is not enabled."* If you see that, you have two choices —
install APCu, or switch to the file cache by putting this in `config.local.php`:
```php
$config['cache']['memory'] = false;
```
The file cache needs no extension, works everywhere, and only requires `engine/cache/` to be
writable.
**APCu is optional.** It saves a few disk reads per request. On a local or low-traffic server you
will not notice the difference — it is worth installing once you have real player traffic.
#### Installing APCu on Windows
Download from **[pecl.php.net/package/APCu/5.1.28](https://pecl.php.net/package/APCu/5.1.28)** and
click the **DLL** link. The build must match your PHP exactly — check yours with `php -i` or
`phpinfo()`:
| Filename part | Comes from |
| --- | --- |
| `8.3` | your PHP version |
| `ts` / `nts` | *Thread Safety* — `enabled` means **ts** |
| `vs16` / `vs17` | *Compiler* — Visual C++ 2019 is `vs16`, 2022 is `vs17` |
| `x64` / `x86` | *Architecture* |
Uniform Server is thread-safe, so with PHP 8.3 it needs
`php_apcu-5.1.28-8.3-ts-vs16-x64.zip`. Most Windows guides say `nts` because that is what other
stacks use — picking the wrong one means the DLL is ignored with no error.
1. Copy `php_apcu.dll` from the zip into your PHP `extensions` (or `ext`) folder — the path in
`extension_dir`.
2. Add to your `php.ini`:
```ini
extension=apcu
apc.enabled=1
```
Uniform Server has no single `php.ini`: the web server reads `php_production.ini` or
`php_development.ini` from `core/php83/` depending on the mode it is running in.
3. Restart Apache, then set `memory` to `true`.
On Linux, `pecl install apcu` or your distribution's `php-apcu` package.
### Already have players?
Open **`/special/`** to convert an existing OT database for ZnoteX.
Coming from another AAC instead? **Admin Panel → Settings → Convert SQL** takes a **MyAAC** or
**Gesior2012** database dump and gives you back a ZnoteX conversion SQL — accounts, players,
news, gallery and the rest. Tables ZnoteX has no equivalent for are preserved rather than
dropped.
### Upgrading
Use **Admin Panel → Update** (see below) — it handles this automatically. If you would rather
do it by hand, replace everything **except** `config.local.php`, `layouts/`, `plugins/` and
`engine/cache/`, apply any new file in `SQL/migrations/`, and check **Admin Panel → Plugins** in
case a plugin has an update waiting.
---
## Update ZnoteX
**Admin Panel → Update** checks, verifies and installs new ZnoteX releases directly from
GitHub — no re-running the installer, no manually copying files. It downloads the release,
checks its digital signature and per-file checksums, runs a pre-installation check (PHP version,
extensions, disk space, writable paths, local modifications), backs up every file it is about to
touch, then installs. If anything goes wrong afterwards, **Restore latest file backup** puts the
previous version straight back.
---
## Features