A simple web application for managing and monitoring maze-based games.
- Games Management: Create, start, view, and terminate games.
- Alerts/Messages: Fetches and displays real-time alerts.
- Stored Procedures: Leverages MySQL procedures for core operations.
- PHP 7.4+ (e.g., via XAMPP)
- MySQL 5.7+ (with correct privileges)
- Web browser (Chrome, Firefox, etc.)
-
Clone or Copy Project
Place the files (e.g.,games.php,game_edit.php,game_view.php, etc.) in your server’s document root (e.g.,htdocs/in XAMPP). -
Database
- Create a MySQL database named
Labirinto. - Run the SQL scripts provided to create tables and stored procedures.
- Ensure each stored procedure is granted
EXECUTEpermission to the role or user.
- Create a MySQL database named
-
Credentials & Sessions
- Adjust
db_connection.phpor your config file to match your MySQL host, user, and password. auth_check.phpensures only authorized users (with the correct MySQL role) can access certain pages.
- Adjust
-
Testing
- In your browser, visit
http://localhost/games.php. - Create, select, and start a game.
- Check the messages/alerts area, which updates every second via AJAX.
- In your browser, visit
-
games.php
Main entry point that displays a list of user’s games.
Supports actions:criar,iniciar,terminar, andvisualizar. -
games_content.php
Template for listing games and their status, plus a real-time alert section. -
game_edit.php
Form for editing a game’s description and alert visibility settings. -
game_view.php
Read-only view of a game’s configuration. -
fetch_messages.php
Returns the updated list of alert messages in HTML format. -
db_connection.php
Connection logic for MySQL (adjust credentials as needed). -
auth_check.php
Verifies that the user is logged in with the correct MySQL role.
- If you see “execute command denied,” verify that the MySQL user has
EXECUTEprivileges on each stored procedure (e.g.,GRANT EXECUTE ON PROCEDURE Labirinto.SomeProcedure TO 'username'@'localhost';). - The alert messages are refreshed via a small JavaScript snippet that calls
fetch_messages.phpevery second. - To preserve a radio button selection on auto-refresh, you can implement an AJAX approach for refreshing only the relevant sections (similar to the alert messages).