Design Document Server Side Overview

From BOARD18 Project WIKI
Jump to: navigation, search
This page has been updated to comply with Release 1.5.x of BOARD18.

The server side of the BOARD18 application will use a minimalist approach. In other words, anything that can be done on the client side, will be done on the client side. This philosophy limits the server mostly to data base access and game logging tasks. The server side of the BOARD18 application will also provide conflict resolution for multi thread database accesses.

Design Document edit


Data Base

BOARD 18 uses MySQL for its data management. A single database, with a data base name of BOARD18, is used.
This database consists of seven tables:

  1. The Auth Tokens Table
  2. The Box Table
  3. The Game Table
  4. The Game Link Table
  5. The Game Player Table
  6. The Players Table

These tables are described in detail on the Data Base Tables page.

Logic

AJAX Called Programs

PHP files that are called by Javascript files
File Name Called Via Called By[1] Return Type[2] MySQL?
allGameList.php post board18View.php JSON file Yes
boxGet.php post board18Boxes.php JSON file Yes
boxShow.php post board18Boxes.php JSON file Yes
boxUpdate.php post board18Boxes.php echo status Yes
changePlayers.php post board18Misc.js echo status Yes
checkForUpdate.php post board18Map3.js echo status Yes
createGame.php post board18New.js echo status Yes
emailPassword.php post board18index.js echo status Yes
emailPlayer.php post board18Players2.js echo status Yes
emailPlayerAdd.php post board18New.js echo status Yes
emailPlayerID.php post board18index.js echo status Yes
emailPlayerRem.php post board18Misc.js echo status Yes
forcePasswd.php post board18Admin.js echo status Yes
gameBox.php getJSON board18Map2.js JSON file Yes
gameGet.php post board18Games.js JSON file Yes
gameSession.php getJSON board18Map.php JSON file Yes
gameShow.php post board18Games.php JSON file Yes
gameSnap.php getJSON board18SnapMap.php JSON file Yes
gameUpdate.php post board18Games.php echo status Yes
linkAdd.php post board18Misc.js echo status Yes
linkDel.php post board18Misc.js echo status Yes
linkGet.php post board18Misc.js JSON file Yes
logout.php post board18Main.php echo status No
myGameList.php post board18Main.php JSON file Yes
newUser.php post board18index.js echo status Yes
playerGet.php post board18Players1.js JSON file Yes
playerShow.php post board18Players1.js JSON file Yes
playerUpdate.php post board18Players1.js echo status Yes
snapShot.php post board18Map6.js echo status Yes
snapShow.php post board18Map7.js JSON file Yes
statSwap.php post board18SnapList.js echo status Yes
tokenCheck.php post index.html echo status Yes
tokenInsert.php post board18index.js echo status Yes
tokenRemove.php post board18index.js echo status Yes
updateGame.php post board18Map3.js echo status Yes
updateUser.php post board18Admin.js echo status Yes
validateUser.php post board18index.js JSON file Yes

Most of the server side processing for BOARD18 is done in stand alone PHP programs that are executed from the web pages via AJAX calls. These programs are listed here with brief descriptions. They are also listed in the table to the right.

  • allGameList.php Returns a list of all the games that are in the database.
  • boxGet.php returns most fields for a box from the box table. It also returns a list of the games associated with the box.
  • boxShow.php returns an array of records from the box table.
  • boxUpdate.php updates the name, the version, the author and/or the status fields in a row in the box table.
  • changePlayers.php Adds and/or removes players from existing game sessions.
  • checkForUpdate.php Checks the database to see if another player has made an update.
  • createGame.php Creates a new row in the game table and adds a row in the game_player table for each player in the game.
  • emailPassword.php Sends an Email containing a temporary password to the player's Email address.
  • emailPlayer.php Sends an Email a specific player.
  • emailPlayerAdd.php Sends an Email a player who has been added to a game.
  • emailPlayerID.php Sends an Email containing the player ID to the player's Email address.
  • emailPlayerRem.php Sends an Email a player who has been removed from a game.
  • forcePasswd.php Processes a forced password change.
  • gameBox.php Returns a game box in JSON format.
  • gameGet.php Returns most fields for a game from the game table and a list of the players who are playing the game.
  • gameSession.php Returns game activity information in JSON format.
  • gameShow.php Returns an array of records from the game table.
  • gameSnap.php Returns a snapshot of game activity information in JSON format.
  • gameUpdate.php Updates the name and/or the status fields in a row in the game table.
  • linkAdd.php adds a game_link record to the game_link table.
  • linkDel.php deletes a game_link record from the game_link table.
  • linkGet.php returns an array of the game_link records for this game.
  • logout.php Logs the current user out of BOARD18.
  • myGameList.php Returns a list of the games that a player is playing.
  • newUser.php Creates a new row in the players table.
  • playerGet.php Returns player data and a list of the player's games.
  • playerShow.php Returns an array of records from the players table.
  • playerUpdate.php Updates a row in the players table.
  • snapShot.php Loads game status updates into the database.
  • snapShow.php Returns an array of the game_snap records for the current game.
  • statSwap.php Toggles game status in the database.
  • tokenCheck.php Checks each auth_token row for a match.
  • tokenInsert.php Inserts a new row in the auth_tokens table.
  • tokenRemove.php Deletes from auth_tokens table any rows for the logged in player.
  • updateGame.php Loads game updates into the database.
  • updateUser.php Updates a row in the players table.
  • validateUser.php Logs the current user in to BOARD18.

Notes for Table to Right

  1. Lists only first calling program.
  2. This standards document describes return types.

Include Modules

There are also a number of php modules that are included (using require once) by some of the above programs to reduce redundant code.

  • auth.php is included at the front of every php program that is listed above [except logout.php, emailPlayerID.php and emailPassword.php] and of every php enabled page. This module checks that the session is signed on and redirects control to access-denied.html if it is not.
  • configMail.php is included at the front of the sendEmail.php module. It contains information used to locate and access a SMTP server.
  • config.php is included at the front of every php program and php enabled page that accesses the board18 database. It contains information used to locate and access the BOARD18 database.
  • loadGameBox.php is a required module for board18BoxLoad.php. It is also a required module for the utility massLoadBoxes.php. It contains three functions: loadBox(), nextBox() and doLoad().
  • rm_r.php is a required module for board18BoxLoad.php. It contains the rm_r() function.
  • sendEmail.php is included at the front of every php program or module that sends Email. It accesses a SMTP server to actually send the email. This module includes some modules obtained from the PHPMailer application.
  • makeTables.php is included into various board18 PHP pages. It supplies a number of functions for creating the HTML to display various tables on those pages.