mirror of
https://github.com/myronblair/tomtomgames-app
synced 2026-06-30 17:49:57 -05:00
v1.0.0
🎰 TomGames Platform — Setup Guide
Files Overview
tomgames/
├── includes/
│ ├── config.php ← ⚠️ EDIT THIS FIRST
│ ├── db.php ← Auto-creates tables
│ ├── auth.php ← Login/register helpers
│ └── square.php ← Square payment API
└── public_html/
├── index.php ← Main mobile app
├── .htaccess ← Security rules
├── create_admin.php ← Run once, then DELETE
└── api/
├── login.php
├── logout.php
├── register.php
├── me.php
├── purchase.php
├── cashout.php
└── admin.php
└── admin/
├── index.php ← Admin dashboard
└── login.php ← Admin login
STEP 1 — Get Your Square Credentials
- Go to https://developer.squareup.com
- Log in with your Square merchant account
- Click "My Apps" → "Create an App" (name it TomGames)
- From the app dashboard, copy:
- Application ID (starts with
sq0idp-) - Access Token (starts with
EAAAlfor production) - Location ID (under Locations tab)
- Application ID (starts with
For testing first, use the Sandbox tab — keys start with
sandbox-sq0idp-
STEP 2 — Create MySQL Database in cPanel
- Log into cPanel → MySQL Databases
- Create database:
tomgames_db - Create user:
tomgames_userwith a strong password - Add user to database with ALL PRIVILEGES
- Note your password — you'll need it in Step 3
STEP 3 — Edit config.php
Open includes/config.php and fill in:
define('DB_PASS', 'YOUR_DATABASE_PASSWORD');
define('SQUARE_APP_ID', 'sq0idp-YOUR_APP_ID');
define('SQUARE_ACCESS_TOKEN', 'EAAAl-YOUR_TOKEN');
define('SQUARE_LOCATION_ID', 'YOUR_LOCATION_ID');
define('SQUARE_ENV', 'production'); // or 'sandbox' for testing
define('SITE_URL', 'https://yourdomain.com');
define('ADMIN_EMAIL', 'your@email.com');
STEP 4 — Upload Files via FTP
FTP Details:
- Host:
fiber18-r.iaasdns.com - Username:
tomgames - Password: (your FTP password)
- Port:
21
Upload structure:
Upload includes/ folder → one level ABOVE public_html
Upload public_html/* content → INTO your server's public_html/
So your server should look like:
/home/tomgames/
├── includes/ ← outside web root (secure!)
└── public_html/
├── index.php
├── .htaccess
├── api/
└── admin/
⚠️ The
includes/folder must be OUTSIDEpublic_htmlso it can't be accessed via browser.
STEP 5 — Create Admin Account
- In your browser, go to:
https://yourdomain.com/create_admin.php - Enter secret key:
TomGames2024Admin - Enter your desired admin username and password
- Click Create Admin
- ✅ Immediately delete
create_admin.phpfrom your server via FTP!
STEP 6 — Test Everything
- Visit
https://yourdomain.com— you should see the login screen - Register a test user account
- Try buying tokens (use Square sandbox first)
- Submit a cashout request
- Log into admin at
https://yourdomain.com/admin/and approve it
Payment Methods
| Method | How it works |
|---|---|
| Credit/Debit Card | Square processes in real-time — tokens added immediately |
| Venmo | Manual — user sends payment, you verify and approve tokens via admin |
| Chime | Manual — same as Venmo |
| Cash App | Manual — same as Venmo |
For Venmo/Chime/Cash App, users submit the request, you verify the payment in those apps, then go to Admin → Users → Adjust Tokens to credit them.
Admin Panel
URL: https://yourdomain.com/admin/
| Feature | Description |
|---|---|
| Dashboard | Stats + pending cashout requests |
| Users | View all users, adjust tokens, suspend accounts |
| Cashouts | Approve or reject cashout requests |
| Purchases | View all purchase history |
Security Checklist
- Change FTP password after upload
- Change GitHub password (it was shared in chat)
- Delete
create_admin.phpfrom server - Set
SQUARE_ENVto'production'when ready - Add your domain to Square's allowed domains in the developer dashboard
- Keep
includes/folder OUTSIDE ofpublic_html
Troubleshooting
Blank page or PHP errors:
- Check that
DB_PASSin config.php is correct - Verify database name and user match what you created in cPanel
Square payment not working:
- Confirm
SQUARE_APP_IDandSQUARE_LOCATION_IDmatch exactly - Add your domain to Square's Web Payments SDK allowed domains
- Start with
sandboxmode for testing
Can't reach admin panel:
- Make sure you ran
create_admin.phpand the admin was created - Go to
/admin/login.phpdirectly
FTP upload issues:
- Make sure
includes/lands at/home/tomgames/includes/(not inside public_html) - Upload
public_html/contents directly INTO your server'spublic_html/
Description
Languages
PHP
99.2%
Shell
0.7%