A web based random MTG card game interface
Go to file
2026-08-03 21:16:57 -04:00
ajax Add feature to use OCR on card images and store with the data so it can be searched on in the gallery 2026-08-03 21:16:57 -04:00
audio Initial commit 2026-07-29 19:51:07 -04:00
core Initial commit 2026-07-29 19:51:07 -04:00
css Add search filter feature to management page 2026-08-03 19:35:44 -04:00
images Add README in images folder 2026-07-29 19:51:45 -04:00
img Initial commit 2026-07-29 19:51:07 -04:00
install Add feature to use OCR on card images and store with the data so it can be searched on in the gallery 2026-08-03 21:16:57 -04:00
js Add feature to use OCR on card images and store with the data so it can be searched on in the gallery 2026-08-03 21:16:57 -04:00
.gitignore Add feature to use OCR on card images and store with the data so it can be searched on in the gallery 2026-08-03 21:16:57 -04:00
.htaccess Initial commit 2026-07-29 19:51:07 -04:00
class_image.php Add feature to use OCR on card images and store with the data so it can be searched on in the gallery 2026-08-03 21:16:57 -04:00
composer.json Add feature to use OCR on card images and store with the data so it can be searched on in the gallery 2026-08-03 21:16:57 -04:00
composer.lock Add feature to use OCR on card images and store with the data so it can be searched on in the gallery 2026-08-03 21:16:57 -04:00
config-dist.php Initial commit 2026-07-29 19:51:07 -04:00
functions.php Initial commit 2026-07-29 19:51:07 -04:00
header.php Add feature to use OCR on card images and store with the data so it can be searched on in the gallery 2026-08-03 21:16:57 -04:00
htmlfooter.php Initial commit 2026-07-29 19:51:07 -04:00
htmlheader.php Initial commit 2026-07-29 19:51:07 -04:00
index.php Initial commit 2026-07-29 19:51:07 -04:00
LICENSE.md Initial commit 2026-07-29 19:51:07 -04:00
login.php Initial commit 2026-07-29 19:51:07 -04:00
logout.php Initial commit 2026-07-29 19:51:07 -04:00
manage.php Add feature to use OCR on card images and store with the data so it can be searched on in the gallery 2026-08-03 21:16:57 -04:00
manifest.json Initial commit 2026-07-29 19:51:07 -04:00
README.md Add a slew of bullet points and notes about how to use the interface 2026-07-30 18:46:04 -04:00
startsession.php Initial commit 2026-07-29 19:51:07 -04:00
thumb.php Initial commit 2026-07-29 19:51:07 -04:00

MTG Random Interface

This small project provides a web based tool for running a bespoke randomized MTG card game.

This project requires

  • PHP ImageMagick

Don't forget to:

  • Create a MySQL/MariaDB database for the app with privileges granted to a user
    • create database mtgrandom
    • create user 'mtgrandom'@'localhost' identified by 'password'
    • grant all privileges on mtgrandom.* to 'mtgrandom'@'localhost'
  • Import the install/initial_db_mysql.sql database structure
    • mysql --host=localhost --user=mtgrandom -p mtgrandom < install/initial_db_mysql.sql
  • Change the ownership of the images/ folder to the web server user
    • chown :www-data images
    • chmod g+ws images
  • Copy the config-dist.php file to config.php and edit that file appropriately

Usage Instructions

Here is a collection of notes about how the interface operates:

  • When the page loads (or reloads) the game is reset
    • Card count is set to zero, but not displayed
    • The server-side list of played cards is emptied
    • Any displayed cards are removed
  • Long pressing (press and hold) an image will toggle a card enabled or disabled
    • Disabled images are not in the pool of available cards when selecting a random card
    • If it is semi-transparent it is disabled
    • if it is not semi-transparent it is enabled
    • Card state can be edited in the management interface
  • Clicking the Show First Card button will show the first card
    • Note that the very first card does NOT increment the card count
  • Clicking the Show Second Card button will:
    • If a single card is displayed it will show a second card
    • If a second card is displayed it will replace the existing second card
    • Note that the Show Second Card button does not appear until at least one card is displayed
  • Clicking the Sun (yellow) icon starts a game
    • A dice is rolled (turn up the volume to hear a dice roll!)
    • The dice results are set to the server as the starting card count
    • The dice roll is displayed over the diamond icon
  • Clicking the Fire (red) icon will replace the most recently played card
    • The replacement card is NOT flagged as played for the current session
    • The replaced card is STILL flagged as played
  • Clicking the Skull (gray) icon will reverse the most recent card play
    • The removed card will be set as "unplayed" in the current session and may show up again
    • It is impossible to go back further than the first card played
    • The card count will go backwards to match the reversed play
  • Clicking the Water (blue) icon will hide the dice roll number displayed on the Sun icon
    • This is currently pointless as the dice roll is always hidden, but the functionality is retained
  • Clicking the Diamond (bottom right) icon will reset the game session
    • Click once to stage the reset and the number will turn red
    • Click a second time to finish resetting the session
    • If it is not clicked a second time before another action is made it will go back to normal
  • Clicking the Tree (green) icon will open the management interface in a new tab
    • This requires login credentials