Memory Match โ Server Documentation
PHP admin panel + API: player tracking, ad management ar 100 level control. Ei page ta server e rekhe dile jekono somoy khule shob info dekha jabe. Ekhane kono secret save hoy na.
๐ง Tomar Domain ar API Key
Niche domain ar key dile pura document e shob code yourdomain.com ar YOUR_API_KEY er jaygay tomar value diye jabe. Key ta browser e-i toiri hoy, kothao pathano ba save kora hoy na.
config.php ar Flutter-er api_service.dart.๐ Overview
Ei server tomake ei kaj gulo korte dey:
- Player tracking: app khulle chup kore server e ping jay, panel e total/active player dekha jay.
- Admin panel: login kore player ban/delete, level edit ar ad setting kora.
- Ad management: AdMob unit ID, on/off, frequency, shob panel theke, app update lagbe na.
- 100 level: prottek level-er card, timer ar coin reward bodlano jay.
Lagbe: PHP 8.1+ (PDO MySQL), MySQL 5.7+ / MariaDB 10.3+, Apache hosting (cPanel e hoy), HTTPS (SSL).
๐ File list
| File / Folder | Kaj |
|---|---|
schema.sql | Database table + 100 level toiri kore (phpMyAdmin e import) |
config.php | DB info ar API_KEY (tumi edit korbe) |
install.php | Prothom admin toiri korar page (por e delete koro) |
login.php / logout.php | Admin login / logout |
dashboard.php | Statistics ar chart |
users.php | Player list, search, ban, delete |
levels.php | 100 level edit |
ads.php | Ad management |
account.php | Password change |
api/register.php | App theke player ping |
api/config.php | App ke ad + level setting dey |
includes/, assets/ | Shared code, CSS/JS (includes/ browser theke block kora) |
.htaccess | config.php ar .sql file protect kore |
docs.html | Ei page |
๐ Setup (A to Z)
schema.sql choose โ Go. Shesh holey levels table e 100 row thakbe.define('DB_HOST', 'localhost');
define('DB_NAME', 'tomar_database');
define('DB_USER', 'tomar_user');
define('DB_PASS', 'tomar_password');
define('API_KEY', 'YOUR_API_KEY');public_html e shob file upload (zip upload kore Extract korle sohoj). .htaccess file ta ao jeno thake (hidden file show on koro).https://yourdomain.com/install.php e giye username/password dao, ba SQL diye.https://yourdomain.com/login.php๐ API Key kibhabe nebe
API key kono company deyna, tumi nijei banao. Eta ekta lomba random password, jeta diye shudhu tomar app server er sathe kotha bolte pare. Tin vabe banano jay:
- Uporer "Generate API Key" button: 48 character-er shokto key toiri hoy.
- Terminal/SSH e:
baphp -r "echo bin2hex(random_bytes(24));"openssl rand -hex 24 - Nijer moto lomba (30+ character) random lekha.
config.php e key boshate hoy na. Panel e key thakle seta-i kaj kore, config.php er key shudhu fallback.Config file diye (purono upay): duita jayga e hubohu ek key
1) Server: config.php
define('API_KEY', 'YOUR_API_KEY');
2) Flutter app: lib/api_service.dart
static const baseUrl = 'https://yourdomain.com/api';
static const apiKey = 'YOUR_API_KEY';
config.php ar api_service.dart duita-i bodlao โ app notun kore build/publish koro. Ager app ba key leak hole purono key diye ar kaj hobe na.๐ค Admin account toiri
Way 1: install.php (sohoj)
https://yourdomain.com/install.php โ username + password (min 10 character) โ Create. Tarpor file ta delete koro. Admin age theke thakle eta 403 dey.
Way 2: SQL diye
Prothome nijer password-er hash banao (server e ba PHP ache emon jekono jaygay):
php -r "echo password_hash('NijerPassword#2026', PASSWORD_DEFAULT);"
Tarpor phpMyAdmin โ SQL tab e:
INSERT INTO admins (username, password_hash)
VALUES ('admin', 'PASTE_HASH_HERE');
Password bhule gele
UPDATE admins SET password_hash = 'PASTE_NEW_HASH' WHERE username = 'admin';
DELETE FROM login_attempts; -- lockout shoriye dey
๐ฅ๏ธ Admin panel guide
| Page | Ki korte pare |
|---|---|
| ๐ Dashboard | Total player, ajker active, notun player, 7 din er active, banned, 7 diner chart, top device model, recently active list. |
| ๐ฅ Players | Name/device/model diye search. Ban: player flag hoy. Delete: record muche jay (app abar khulle notun player hishebe ashbe). |
| ๐ฎ Levels | 1-100 level edit, nicher Levels section dekho. |
| ๐ฐ Ads | Shob ad setting, nicher Ads section dekho. |
| ๐ Account | Admin password change. |
Login 30 minute kichu na korle auto logout hoy. 5 bar vul password dile 15 minute er jonno lock hoy.
๐ฐ Ad management
AdMob unit ID kothay pabe
- admob.google.com e account khulo โ Apps โ Add app (tomar app ta add koro).
- App er bhitore Ad units โ Banner, Interstitial, Rewarded, tin ta alada alada toiri koro.
- Prottek ad unit er ID dekhte ei rokom:
ca-app-pub-1234567890123456/1234567890.
Panel e boshano (Ads page)
| Setting | Mane |
|---|---|
| Ads enabled | Master switch. Off korle app e kono ad dekhabe na. |
| Test mode | On thakle Google-er demo ad dekhay (development e on rakho). Real ad dekhate off koro. |
| Banner / Interstitial / Rewarded | Alada alada on-off. Banner = game screen er niche, Interstitial = level jitle, Rewarded = time sesh holey extra time. |
| Interstitial every N | 1 = proti level jetar por, 3 = proti 3 ta level jetar por. |
| Extra seconds / Coin price | Time sesh holey koto second pabe ar coin diye nile koto coin lagbe. |
| Android / iOS units | Prottek platform er alada 3 ta unit ID. Khali rakhle test ad dekhabe. |
ca-app-pub-xxx~yyy) Android AndroidManifest.xml / iOS Info.plist e thake. Eta panel theke bodlano jay na, app build er somoy boshate hoy.๐ฎ Levels (1-100)
Levels page e prottek level-er 3 ta jinis edit kora jay, tarpor Save all levels chapo:
- Cards: 4 theke 24, shob shomoy jor shonkha (even).
- Time: second.
0mane timer nai. Timer dile 10-600. - Reward: level jitle base coin (app e star bonus ar bachano time bonus alada jog hoy).
Default: Level 1 = 4 card, Level 2 = 12, Level 3-9 = 16, Level 10-29 = 20, Level 30+ = 24 card. Vul value dile ager value-i thake.
๐ API reference
Base URL: https://yourdomain.com/api. Shob request e header: Authorization: Bearer YOUR_API_KEY. Response shob shomoy JSON: {"status":"ok",...} ba {"status":"error","message":"..."}.
POST /register.php โ player ping
curl -X POST https://yourdomain.com/api/register.php \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"device_id":"a1b2c3d4e5f6a7b8","name":"Player-123","model":"Pixel 7","app_version":"1.0.0"}'
| Field | Rule |
|---|---|
| device_id | 8-64 char: A-Z a-z 0-9 _ - |
| name | 1-30 character |
| model | max 60 character |
| app_version | 1-20 character (0-9 A-Z a-z . + _ -) |
Success: {"status":"ok","banned":false}. Ekoi device_id abar ping dile notun player hoy na, last_seen ar open_count update hoy.
GET /config.php โ ad + level setting
curl https://yourdomain.com/api/config.php \
-H "Authorization: Bearer YOUR_API_KEY"
Response e ads (enabled, test_mode, banner, interstitial, rewarded, interstitial_every, extra_seconds, extra_coin_cost, units.android/ios) ar levels list (l level, c cards, t time, r reward) thake.
Error code
| Code | Mane |
|---|---|
| 400 | JSON vul |
| 401 | API key nai ba vul |
| 405 | Vul method (POST/GET) |
| 413 | Data 4KB er beshi |
| 422 | Field vul (message e bole kon ta) |
| 429 | Onek beshi request (default 120/minute/IP) |
| 500 | Server error ba API_KEY config kora nai |
๐งช API tester
Uporer domain ar key diye server thik moto chalche kina check koro. Register test e "Docs-Test" namer ekta player toiri hobe, Players page theke delete kore dio.
Result ekhane ashbeโฆ
๐ฑ Flutter app connect
lib/api_service.dart e domain ar key boshao:
static const baseUrl = 'https://yourdomain.com/api';
static const apiKey = 'YOUR_API_KEY';flutter run. App khulle chup kore ping jay ar config nay.๐ก๏ธ Security checklist
- โ HTTPS (SSL) chalu rakho (cPanel โ SSL/TLS Status / AutoSSL).
- โ
install.phpdelete koro. - โ Admin password onek lomba ar unique rakho, ager shared password bodle nao.
- โ
API key lomba random,
config.phpkokhono public kore dio na. - โ Niyomito database backup nao (cPanel โ Backup ba phpMyAdmin Export).
- โ Server er PHP version update rakho (8.1+).
- โ
Chaile
docs.htmlsetup sesh hole delete koro. Eta secret rakhe na, tobe tomar server er structure dekhay.
Already ache: SQL injection protection, CSRF token, secure session cookie, login lockout, API rate limit, input validation, security header.
๐ฉบ Troubleshooting
| Somossha | Somadhan |
|---|---|
| API 401 Unauthorized | Key duita jayga e hubohu mile nai, ba header e Bearer nai. Apache e .htaccess upload hoyeche kina dekho. Nginx hole fastcgi_param HTTP_AUTHORIZATION $http_authorization; dao. |
| 500 "Server not configured" | config.php e API_KEY ager default value-i ache, notun key boshao. |
| 500 "Server error" | Database name/user/password vul, ba schema.sql import hoy ni. cPanel Errors / error_log dekho. |
| 429 Too many requests | Ek minute opekkha koro. Proyojone config.php e API_RATE_LIMIT_PER_MIN barao. |
| Login e "Too many failed attempts" | 15 minute opekkha koro, ba SQL: DELETE FROM login_attempts; |
| "Invalid request (CSRF)" | Page reload kore abar try koro, browser cookie on rakho. |
| install.php 403 | Admin age theke ache. Login koro, ba SQL diye password reset koro. |
| Blank / 500 page | PHP version 8.1 er kom, ba pdo_mysql extension off. cPanel โ Select PHP Version. |
| App e ad ashche na | Ads enabled/ type on kina dekho. Real ad e unit ID format sothik, Test mode off, AdMob App ID manifest e ache kina, ar app restart koro. Notun ad unit e kichu ghonta lagte pare. |
| Panel e notun setting app e nai | App ekbar bondho kore abar kholo, ar internet on rakho. |
| API tester e "Failed to fetch" | Domain thik kina, HTTPS ache kina, ar server chalu kina dekho. |