Skip to content

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

RetroHub 🎮

RetroHub is a browser-based retro gaming platform built with PHP, MySQL, and vanilla HTML/CSS/JS. It lets players browse classic-console libraries, launch games directly in the browser, and gives admins a dashboard to manage consoles, ROMs, users, and inbound messages.

What’s Inside

  • 🚀 Landing & marketing pages (index.html, about.html, support.html) with CTA to browse/login.
  • 🕹️ Authenticated game library (library.php + library.html) that lists consoles/games from MySQL.
  • ▶️ In-browser play view (play.php) that loads ROMs via JS emulator (js/nds-emulator.js) with touch controls for mobile.
  • 🔐 User auth (login.php, config/user_auth.php) with session-based access control and redirect-after-login.
  • 🛠️ Admin panel (admin/*) for dashboards, games/consoles/users CRUD, ROM/image upload, newsletters, and contact-message triage.
  • 🗄️ MySQL schema & seed data (database.sql) with default consoles and an admin user.

Quick Start

Step Action
1️⃣ Install PHP 8+, MySQL 5.7+/8+, and a web server (Apache via XAMPP/LAMP/WAMP).
2️⃣ Create database: CREATE DATABASE retrohub; then import database.sql.
3️⃣ Configure DB creds in config/database.php (defaults: host localhost, db retrohub, user root, pass empty).
4️⃣ Place the repo in your web root (e.g., htdocs/RT) and ensure PHP can write to uploads/ and uploads/covers/.
5️⃣ Browse to http://localhost/RT/index.html (public site) or http://localhost/RT/login.php (user login).
6️⃣ Admin portal: http://localhost/RT/admin/ (default login admin / admin123 from database.sql — change immediately).

Directory Map

RT/
├─ admin/             # Admin dashboard (games, consoles, users, uploads, messages)
├─ config/            # DB connection + auth helpers
├─ css/, js/          # Front-end styling and behavior
├─ images/, uploads/  # Assets and uploaded covers/ROMs
├─ *.html / *.php     # Public pages (home, about, support, library, play)
└─ database.sql       # Schema + seed data (consoles, default admin)

Key Flows

  • User login → library → play: login.php sets session → library.php (requires login) fetches consoles/games → play.php loads ROM (roms/<file>) into the JS emulator with keyboard + touch controls.
  • Admin management: admin/index.php (login) → dashboard.php shows stats, top/recent games, unread messages → navigate to games/consoles/users CRUD, ROM/image uploads (upload.php, upload_image.php), newsletter, and settings.
  • Contact/newsletter: Public forms post to process_contact.php / process_newsletter.php; admins read/respond in admin/messages.php and admin/newsletter.php.

Database Snapshot

  • consoles — catalog of supported systems (name, short_code, release_year, metadata).
  • games — title, console_id, rom file path, cover, metadata (genre, region, rating, play_count, featured flag).
  • users — auth table with is_admin and last_login.
  • game_saves — user save data blobs (per game).
  • Seeded data: 6 sample consoles + default admin (admin / admin123, hashed in SQL).

Configuration Notes

  • Update DB credentials in config/database.php.
  • Session helpers:
    • Admin: config/auth.php (isAdmin(), requireAdmin(), logout()).
    • User: config/user_auth.php (isLoggedIn(), requireLogin(), redirect preservation).
  • ROMs/Covers:
    • Default ROM fetch path in play.php: roms/<rom_file>; ensure files exist and are web-readable.
    • Uploaded covers/ROMs land under uploads/ and uploads/covers/ (ensure write perms).

Running Locally (example: XAMPP on Windows)

  1. Copy repo to C:\xampp\htdocs\RT.
  2. Start Apache + MySQL in XAMPP.
  3. Import database.sql into MySQL (e.g., via phpMyAdmin or mysql -u root retrohub < database.sql).
  4. Visit http://localhost/RT/index.html.

Security & Production Hardening

  • 🔑 Change the default admin password immediately after import.
  • 🔒 Set a strong MySQL user/password and update config/database.php.
  • 🧹 Validate ROM uploads and limit allowed types/sizes in admin/upload.php and related handlers.
  • 🛡️ Serve over HTTPS; set secure cookies and sane session lifetimes for production.
  • 📜 Respect licensing: only host ROMs you are legally permitted to distribute/use.

Troubleshooting

  • Blank page / DB errors: Check credentials in config/database.php; confirm DB is running and retrohub exists.
  • 404 on ROM load: Verify files under roms/ (or uploads/) match the games.file_path/rom_file fields.
  • Permission denied on upload: Grant webserver write access to uploads/ and uploads/covers/.
  • Stuck redirect to login: Session may be missing; ensure cookies are enabled and PHP sessions are writable.

Roadmap Ideas

  • Cloud/object storage for ROMs and covers.
  • Role-based permissions (moderators vs. admins).
  • Better game search/filtering + ratings/reviews.
  • Multi-console emulator support beyond NDS/PS2/PSP/SNES.

Acknowledgements

  • Built for educational purposes; honors the preservation spirit of retro gaming.
  • Front-end styling uses Bootstrap 5 + Font Awesome; animations via AOS.

About

RetroHub is a browser-based retro gaming platform built with PHP, MySQL, and vanilla JS. It lets users browse classic consoles, play ROMs directly in the browser, and includes an admin panel for managing games, consoles, users, and uploads.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages