README: update project structure and self-hosting steps for setup.php
This commit is contained in:
parent
09d601e303
commit
7b638d4afb
1 changed files with 33 additions and 25 deletions
40
README.md
40
README.md
|
|
@ -70,10 +70,12 @@ guessTheLiar/
|
||||||
├── api.php # REST API for all game actions
|
├── api.php # REST API for all game actions
|
||||||
├── auth.php # Login, session management, PIN handling
|
├── auth.php # Login, session management, PIN handling
|
||||||
├── migrate.php # Automatic DB migration system (V1–V8)
|
├── migrate.php # Automatic DB migration system (V1–V8)
|
||||||
|
├── setup.php # One-time admin setup (self-deletes after use)
|
||||||
├── login.php # Login page
|
├── login.php # Login page
|
||||||
├── profile.php # Player profile & lifetime statistics
|
├── profile.php # Player profile & lifetime statistics
|
||||||
├── admin.php # Admin panel (user management)
|
├── admin.php # Admin panel (user management)
|
||||||
├── config.php # DB credentials (not in repo — see setup below)
|
├── config.php # DB credentials — not in repo, copy from below
|
||||||
|
├── config.example.php # Credential template (safe to commit)
|
||||||
├── schema.sql # Initial DB schema reference
|
├── schema.sql # Initial DB schema reference
|
||||||
└── identity/ # Logo & favicon (PNG + PSD)
|
└── identity/ # Logo & favicon (PNG + PSD)
|
||||||
```
|
```
|
||||||
|
|
@ -129,29 +131,35 @@ All actions go through `api.php?action=<name>` (GET or POST with a JSON body).
|
||||||
|
|
||||||
**Requirements:** PHP 8.1+, MySQL 8+, web server (Apache or Nginx)
|
**Requirements:** PHP 8.1+, MySQL 8+, web server (Apache or Nginx)
|
||||||
|
|
||||||
|
**1. Clone the repo**
|
||||||
```bash
|
```bash
|
||||||
git clone https://github.com/<your-username>/guessTheLiar.git
|
git clone https://github.com/daniediekert-blip/guessTheLiar.git
|
||||||
cd guessTheLiar
|
cd guessTheLiar
|
||||||
```
|
```
|
||||||
|
|
||||||
Create `config.php`:
|
**2. Create the database**
|
||||||
```php
|
|
||||||
<?php
|
|
||||||
return [
|
|
||||||
'host' => 'localhost',
|
|
||||||
'dbname' => 'your_database',
|
|
||||||
'user' => 'your_db_user',
|
|
||||||
'pass' => 'your_db_password',
|
|
||||||
'charset' => 'utf8mb4',
|
|
||||||
];
|
|
||||||
```
|
|
||||||
|
|
||||||
Create the database:
|
|
||||||
```sql
|
```sql
|
||||||
CREATE DATABASE your_database CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
CREATE DATABASE your_database CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
|
||||||
```
|
```
|
||||||
|
|
||||||
All tables are created automatically by the migration system on the first page load.
|
**3. Create `config.php`** (copy from the template)
|
||||||
|
```bash
|
||||||
|
cp config.example.php config.php
|
||||||
|
```
|
||||||
|
Then fill in your credentials — `config.php` is in `.gitignore` and will never be committed.
|
||||||
|
|
||||||
|
**4. Run the setup wizard**
|
||||||
|
|
||||||
|
Open `https://yourdomain.com/setup.php` in your browser. Enter a username and password for the admin account and submit the form.
|
||||||
|
|
||||||
|
The setup wizard will:
|
||||||
|
- Run all database migrations automatically (creates every table)
|
||||||
|
- Create the admin account
|
||||||
|
- **Delete itself** — `setup.php` is removed from the server automatically on success
|
||||||
|
|
||||||
|
If auto-delete fails due to file system permissions, remove `setup.php` manually.
|
||||||
|
|
||||||
|
**5. Done** — open `index.html` and start playing.
|
||||||
|
|
||||||
---
|
---
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue