Difference between revisions of "Design Document PHP Coding Details"

From BOARD18 Project WIKI
Jump to navigation Jump to search
(→‎createGame.php: corrected initial content)
(→‎configMail.php: initial content)
Line 57: Line 57:


===configMail.php===
===configMail.php===
configMail.php is included at the start of sendEmail.php which
sends SMTP emails via PHPMailer.  Modify MAIL_HOST, MAIL_PORT,
MAIL_USER and MAIL_PASS to the values appropriate for your Email server.
  define('MAIL_HOST', 'mail.server.org');
  define('MAIL_PORT', '587');  // STARTTLS
  define('MAIL_USER', 'user@server.org');
  define('MAIL_PASS', 'xxxxxxxxxx');
===config.php===
===config.php===
config.php is included at the start of all pages and php routines
config.php is included at the start of all pages and php routines

Revision as of 17:16, 15 December 2013

Design Document edit


This page has details of all of the PHP files that are described in the Server Side Overview. The origional description for each file has been taken from the comments at the top of the file in question. While creating this page I will also be bringing these comments in line with these Standards.

AJAX Called Programs

An oveview discussion of these programs is available here.

changePlayers.php

changePlayers.php is the server side code for the AJAX changePlayers call. This program adds and/or removes players from existing game sessions.

Inputs:

  mode - A string with a value of '1', '2' or '3'.
         1 - Remove player with login ID in prem.
         2 - Add player with login ID in padd.
         3 - Take both of the above actions.
  game - game_id of current game.
  prem - Login ID of the player to be removed from the game.
  padd - Login ID of the player to be added to the game.  

Output is an echo return status of either "success", "fail" or "dupadd".

createGame.php

This is the server side code for the AJAX createGame call. It creates a new row in the game table and adds a row in the game_player table for each player in the game. Input is the following JSON string.

 {
   "gname": "name",
   "boxid": "boxid",
   "players": [
     "pname0",
     . . . . . 
     "pnamen",
   ] 
 }

Output is the echo return status "success", "fail", "nobox" or "noplayer #".

emailPlayerAdd.php

emailPlayerRem.php

emailPlayerID.php

emailPassword.php

forcePasswd.php

gameBox.php

gameSession.php

logout.php

myGameList.php

newUser.php

updateGame.php

updateUser.php

validateUser.php

Include Modules

An oveview discussion of these modules is available here.

auth.php

auth.php is included at the start of all password protected pages and all password protected PHP programs called via AJAX.
It starts a php session and then checks to see that the player is logged in and has been active sometime in the last 30 minutes.

configMail.php

configMail.php is included at the start of sendEmail.php which sends SMTP emails via PHPMailer. Modify MAIL_HOST, MAIL_PORT, MAIL_USER and MAIL_PASS to the values appropriate for your Email server.

 define('MAIL_HOST', 'mail.server.org');
 define('MAIL_PORT', '587');  // STARTTLS
 define('MAIL_USER', 'user@server.org');
 define('MAIL_PASS', 'xxxxxxxxxx');

config.php

config.php is included at the start of all pages and php routines that access the board18 database. Modify DB_HOST and if necessary DB_DATABASE to contain the correct database host and name. You can also change the database user ID and password here.

 define('DB_HOST', 'localhost');
 define('DB_DATABASE', 'board18');
 define('DB_USER', 'board18');
 define('DB_PASSWORD', 'board18');

sendEmail.php

makeTables.php


This page is a stub.
The BOARD18 Project will soon be expanding it.