|
1 | 1 | # Inquiry Management System |
2 | 2 |
|
3 | | -Version: v0.1.0 |
| 3 | +Version: **v0.2.0** |
4 | 4 |
|
5 | | -A lightweight inquiry management system built with pure PHP + MySQL. |
| 5 | +A pure PHP + MySQL inquiry management system for collecting inquiry forms from multiple websites into one centralized backend. |
6 | 6 |
|
7 | | -## Current scope in v0.1.0 |
| 7 | +## v0.2.0 Highlights |
8 | 8 |
|
9 | | -- Project scaffold and directory structure |
10 | | -- PDO database connection layer |
11 | | -- Login / logout |
12 | | -- Session + CSRF helper |
13 | | -- Basic dashboard |
14 | | -- Inquiry list page |
15 | | -- Inquiry detail page |
16 | | -- Site list page |
17 | | -- Blacklist IP page |
18 | | -- Personal settings page |
19 | | -- SQL schema and seed files |
20 | | -- Changelog and versioned delivery structure for GitHub Desktop workflow |
| 9 | +- Unified receive API is ready: `/api/v1/inquiries/submit` |
| 10 | +- `site_key + api_token` validation |
| 11 | +- Required field validation for `name`, `email`, `content` |
| 12 | +- Stores both `extra_data` and `raw_payload` |
| 13 | +- Basic anti-spam checks |
| 14 | +- Blocked IP validation |
| 15 | +- Inquiry filters and quick status actions in the backend |
| 16 | +- GitHub Actions ZIP packaging workflow included |
21 | 17 |
|
22 | | -## Recommended environment |
| 18 | +## Environment |
23 | 19 |
|
24 | 20 | - PHP 8.1+ |
25 | | -- MySQL 5.7+ or MariaDB 10.4+ |
26 | | -- Apache / Nginx |
| 21 | +- MySQL 5.7+ or MySQL 8+ |
| 22 | +- Apache or Nginx |
27 | 23 |
|
28 | | -## Quick start |
| 24 | +## Installation |
29 | 25 |
|
30 | | -1. Create a new MySQL database, for example: `inquiry_system` |
31 | | -2. Import the SQL files in order: |
| 26 | +1. Create a database, for example: `inquiry_system` |
| 27 | +2. Import: |
32 | 28 | - `database/schema.sql` |
33 | 29 | - `database/seed.sql` |
34 | | -3. Update database config in: |
35 | | - - `config/database.php` |
36 | | -4. Put the project in your web root and point the document root to: |
37 | | - - `public/` |
38 | | -5. Open the system in your browser. |
| 30 | +3. Update database settings in `config/database.php` |
| 31 | +4. Point your web root to `public/` |
| 32 | +5. Open the project in your browser |
39 | 33 |
|
40 | | -## Default admin account |
| 34 | +## Default Admin Account |
41 | 35 |
|
42 | 36 | - Username: `admin` |
43 | 37 | - Password: `Admin@123456` |
44 | 38 |
|
45 | | -Please change the password immediately after first login. |
| 39 | +## Main Backend Routes |
46 | 40 |
|
47 | | -## Suggested GitHub Desktop workflow |
| 41 | +- `/login` |
| 42 | +- `/dashboard` |
| 43 | +- `/inquiries` |
| 44 | +- `/sites` |
| 45 | +- `/tools/blacklist-ips` |
| 46 | +- `/profile` |
48 | 47 |
|
49 | | -For each delivery version: |
| 48 | +## API Routes |
50 | 49 |
|
51 | | -1. Replace the local project files with the new full package |
52 | | -2. Review `CHANGELOG.md` |
53 | | -3. Commit with a versioned message, such as: |
54 | | - - `v0.1.0 initial scaffold` |
55 | | - - `v0.2.0 add inquiry receiving API` |
56 | | -4. Push to GitHub |
57 | | -5. Optionally create a Git tag |
| 50 | +### Health Check |
58 | 51 |
|
59 | | -## Planned next step |
| 52 | +`GET /api/v1/health` |
60 | 53 |
|
61 | | -v0.2.0 will focus on: |
| 54 | +### Submit Inquiry |
62 | 55 |
|
63 | | -- Inquiry receiving API |
64 | | -- Site token validation |
65 | | -- Basic anti-spam checks |
66 | | -- Insert inquiry records from external websites |
| 56 | +`POST /api/v1/inquiries/submit` |
| 57 | + |
| 58 | +Supported payload types: |
| 59 | + |
| 60 | +- `application/json` |
| 61 | +- standard form POST |
| 62 | + |
| 63 | +### Minimum payload |
| 64 | + |
| 65 | +```json |
| 66 | +{ |
| 67 | + "site_key": "a_main", |
| 68 | + "api_token": "token_a_main_2026", |
| 69 | + "name": "John Smith", |
| 70 | + "email": "john@example.com", |
| 71 | + "content": "I want more information about your products." |
| 72 | +} |
| 73 | +``` |
| 74 | + |
| 75 | +### Optional fields |
| 76 | + |
| 77 | +- `form_key` |
| 78 | +- `title` |
| 79 | +- `country` |
| 80 | +- `phone` |
| 81 | +- `address` |
| 82 | +- `from_company` |
| 83 | +- `source_url` |
| 84 | +- `referer_url` |
| 85 | +- `language` |
| 86 | +- `browser` |
| 87 | +- `device_type` |
| 88 | +- `submitted_at` |
| 89 | +- `client_ip` |
| 90 | +- `extra_data` (array) |
| 91 | + |
| 92 | +Unknown fields will also be merged into `extra_data` automatically. |
| 93 | + |
| 94 | +## Example Files |
| 95 | + |
| 96 | +- `examples/php-forwarder.php` |
| 97 | +- `examples/javascript-fetch-example.js` |
| 98 | + |
| 99 | +## GitHub Actions |
| 100 | + |
| 101 | +Workflow file: |
| 102 | + |
| 103 | +- `.github/workflows/build-release.yml` |
| 104 | + |
| 105 | +It creates a ZIP package automatically when you push a tag like: |
| 106 | + |
| 107 | +```bash |
| 108 | +git tag v0.2.0 |
| 109 | +git push origin v0.2.0 |
| 110 | +``` |
| 111 | + |
| 112 | +## Notes |
| 113 | + |
| 114 | +Recommended production flow: |
| 115 | + |
| 116 | +1. Website form submits to the current website backend |
| 117 | +2. The current website backend forwards the payload to this central system |
| 118 | +3. This system validates, filters, stores, and manages the inquiry |
| 119 | + |
| 120 | +This is safer than exposing tokens directly in front-end JavaScript. |
0 commit comments