Difference between revisions of "Design Document PHP Coding Details"

From BOARD18 Project WIKI
Jump to navigation Jump to search
(→‎gameUpdate.php: add link functions)
 
(21 intermediate revisions by the same user not shown)
Line 1: Line 1:
{{ReleaseNotice|1.3}}{{Design Document Index}}
{{ReleaseNotice|2.7}}{{Design Document Index}}
This page has details of all of the PHP files that are described in the [[Design_Document_Server_Side_Overview|Server Side Overview]]. The origional description for each file has been taken from the comments at the top of the file in question. When I created this page I also  brought these comments in line with [[Coding Standards Documentation|these Coding Standards]].
This page has details of all of the PHP files that are included in other PHP code via the REQUIRE command.
==AJAX Called Programs==
An oveview discussion of these programs is available [[Design_Document_Server_Side_Overview#AJAX_Called_Programs|here]].
===allGameList.php===


This is the server side code for the AJAX allGameList call.
An oveview discussion of all PHP programs is available
[[Design_Document_Server_Side_Overview|here]].


It produces the data needed to create a list of all games
==auth.php==
in the database.
auth.php is included at the start of all password protected pages
and all password protected PHP programs called via AJAX.<br>
If the PHP program doing the include was called via AJAX then
authajax.php will be used instead of auth.php. <br>
Otherwise auth.php will start a php session and then check to
see that:
* The player is logged on and
* The player has been active sometime in the last 24 hours.
If either of these conditions has not been met then control will
be transferred to access-denied.html.


There are no input parameters.
==authajax.php==
If auth.php has been included by a program that was called via AJAX
then it will include authajax.php and leave the work to it.


Output is the following stringified JSON data structure.  
authajax.php will start a php session and then check to see that:  
  {
* The player is logged on and
    "stat":"success",
* The player has been active sometime in the last 24 hours.
    "games":
If either of these conditions has not been met then authajax.php
    [
will echo '''<!doctype html>''' and exit to the callback function.
      {
        "game_id":"nnnn",
        "gname":"gggg",
        "bname":"bbbb",
        "version":"vvvv",
        "start_date":"mm/dd/yyyy"
      },
      . . . . more games . . . . .
    ]
  }


===changePlayers.php===
For a better explanation of why this is done see
changePlayers.php is the server side code for the
[https://bugs.board18.org/show_bug.cgi?id=197 <span style="color: Green">Comment 7 in Bug 197 in BOARD18 Bugzilla</span>].
AJAX changePlayers call. This program adds and/or
removes players from existing game sessions.


Inputs:
==configMail.php==
  mode - A string with a value of '1', '2' or '3'.
configMail.php is included at the start of sendEmail.php which
          1 - Remove player with login ID in prem.
sends SMTP emails via PHPMailer. Modify MAIL_HOST, MAIL_PORT,
          2 - Add player with login ID in padd.
MAIL_USER and MAIL_PASS to the values appropriate for your Email server.
          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".
MAIL_SENDER defines the text that will appear in the "From" field
of the Email. All replies will be directed here.


===checkForUpdate.php===
  define('MAIL_HOST', 'mail.server.org');
checkForUpdate.php is the server side code for the AJAX checkForUpdate call. It checks the database to see if another player has made an update.
  define('MAIL_PORT', '587');  // STARTTLS
  define('MAIL_USER', 'user@server.org');
  define('MAIL_PASS', 'xxxxxxxxxx');
  define('MAIL_SENDER', 'adminuser@server.org');


Input is the gameID.
==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.


Output will be "noupdate", "updatefound" or "failure".
   define('DB_HOST', 'localhost');
 
   define('DB_DATABASE', 'board18');
The SESS_UPDATE_COUNTER session variable which is used by updateGame.php to support optimistic database
   define('DB_USER', 'board18');
locking is also used by checkForUpdate.php to detect updates made by another player.
   define('DB_PASSWORD', 'board18');
 
===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 #".
 
===emailPlayer.php===
emailPlayer.php is the server side code for the
AJAX emailPlayer call. It creates a
text email for a specific player. If the email
creation is successful it then calls sendEmail.php
and exits. This leaves it to sendEmail to return the
final 'success' status.
Input consists the following parameters:
   login
  subject
  body
 
Output, if any, is the echo return status "fail".
 
===emailPlayerAdd.php===
emailPlayerAdd.php is the server side code for the
AJAX emailPlayerAdd call.
It creates a text email to notify a player
that has been added to a game. If the email
creation is successful it then calls sendEmail.php
and exits. This leaves it to sendEmail to return the
final 'success" status.
 
Input consists the following parameters:
  login
  game
 
Output, if any, is the echo return status "fail".
 
===emailPlayerRem.php===
emailPlayerRem.php is the server side code for the
AJAX emailPlayerRem call.
It creates a text email to notify a player
that has been removed from a game. If the email
creation is successful it then calls sendEmail.php
and exits. This leaves it to sendEmail to return the
final 'success" status.
 
Input consists the following parameters:
   login
  game
 
Output, if any, is the echo return status "fail".
 
===emailPlayerID.php===
emailPlayerID.php is the server side code for the
AJAX emailPlayerID call.
 
It creates a text email to remind a player (that
has forgotten) of his player ID. If the email
creation is successful it then calls sendEmail.php
and exits. This leaves it to sendEmail to return the
final 'success" status.
 
Input consists the "email" parameter.
 
Output, if any, is the echo return status "fail" or "bademail".
 
===emailPassword.php===
emailPassword.php is the server side code for the
AJAX emailPassword call.
 
It creates a text email to inform a player of his
new temporary password. If the email
creation is successful it then calls sendEmail.php
and exits. This leaves it to sendEmail to return the
final 'success" status.
 
Input consists the following parameters:
  name
  email
 
Output, if any, is the echo return status "fail" or "bademail".
 
===forcePasswd.php===
forcePasswd.php is the server side code for the
AJAX forcePasswd call.
 
It will process a forced password change.
 
Input consists the following parameters:
  player
  passwd
 
Output will be "success", "fail" or an edit failure code.
 
===gameBox.php===
This is the server side code for the AJAX gameBox call.
 
It returns a game box in JSON format.
 
Input is the game box id.
 
Output is JSON game box data.
 
===gameGet.php===
This is the server side code for the AJAX gameGet call.
 
It returns most fields for a game from the game table.
It also returns a list of the players who are playing the game.
 
Input is: gameid.
 
Output is the following stringified JSON data structure.
  {
    "stat":"success||"fail"||"noplayers",
    "gameid":"nnnn",
    "gname":"aaaaaa",
    "bname":"bbbbbb",
    "sdate":"yyy-mm-dd hh:mm:ss",
    "adate":"yyy-mm-dd hh:mm:ss",
    "lastupdater":"llllllll",
    "status":"sssss",
    "players":
    [
      {
        "playerid":"nnnn",
        "login":"pppppp",
        "fname":"fffffff",
        "lname":"ggggggg"
      },
      . . . . more players . . . . .
    ]
  }
 
===gameSession.php===
This is the server side code for the AJAX gameSession call.
 
It returns game activity information in JSON format.
 
Input is the game_id.
 
Output is JSON game session data.
 
The SESS_UPDATE_COUNTER is initialized
here and used by updateGame.php to support optimistic
database locking. <br>This should stop concurrent updates from
messing up the database.
 
===gameShow.php===
This is the server side code for the AJAX gameShow call.
 
It returns an array of records from the game table.
 
Input is: blocksz and startrow.
 
Output is the following stringified JSON data structure.
  {
    "stat":"success||"nogames"||"fail",
    "games":
    [
      {
        "gameid":"nnnn",
        "gname":"gggggg",
        "bname":"aaaaaa",
        "sdate":"yyy-mm-dd hh:mm:ss",
        "adate":"yyy-mm-dd hh:mm:ss",
        "boxid":"eeeeee",
        "status":"fffff",
        "pcount":"nnnnnn"
      },
      . . . . more games . . . . .
    ]
  }
 
===gameSnap.php===
This is the server side code for the AJAX gameSnap call.
 
It returns a snapshot of game activity information in JSON format.
 
Input is the snapshot id.
 
Output is JSON game session data.
 
===gameUpdate.php===
This is the server side code for the
AJAX gameUpdate call.
 
It updates the name and/or the status fields
in a row in the game table.
 
Input consists the following parameters:
 
  gameid 
  gname
  status
 
Output is the echo return status:
  "success", "fail", "gname".
 
===linkAdd.php===
This is the server side code for the AJAX linkAdd call.
 
It adds a game_link record to the game_link table.
 
Input is: gameid, linkname and linkurl.


Output is the echo return status:
==loadGameBox.php==
  "success", "fail" or "duplicate".  
loadGameBox.php is a required module for board18BoxLoad.php.
It is also a required module for the utility massLoadBoxes.php.


===linkDel.php===
It contains three functions: loadBox(), nextBox() and doLoad().<br>
This is the server side code for the AJAX linkDel call.
The doLoad() function does most of the work but it is only called
by one of the other two functions in the loadGameBox.php module.<br>
The loadBox() function sets up doLoad when running on a web server.<br>
The nextBox() function sets up doLoad when processing in cli mode.


It deletes a game_link record from the game_link table.
===doLoad()===
doLoad() uses the contents of an input zip file
to create a game box or to modify an existing game box. <br>
It returns the output described below with a status and with
optional report information to be emailed to the author.


Input is: gameid and linkname.
Input:
  $zipFileName - the name of the zip file to be loaded.
  $zipFileLoc - the location of the zip file to be loaded.
  $authorID - the player ID of the submitter of the game box.
  $webRoot - the root of the Board18 web site being loaded to.
  $link - the mysqli_connect link for the BOARD18 database.
  $report - a response class structure to be used for the output.


Output is the echo return status:
Output is the following stringified JSON data structure [object].  
  "success", "fail" or "missing".
 
===linkGet.php===
This is the server side code for the AJAX linkGet call.
 
It returns an array of the game_link records for this game.
 
Input is: gameid.
 
Output is the following stringified JSON data structure.  
   {
   {
     "stat":"success||none||fail",
     "stat":"success"||"fail"||"nofile"||"toobig"||"email",
     "links":
    "author":authorLogin,
     "rpttext":
     [
     [
       {
       "textline"
        "link_name":"aaaaaa",
      "textline"
        "link_url":"bbbbbbb",
      "textline"
        "act_date":"mm/dd/yyyy"
      . . . . .
      },
      . . . . more links . . . . .  
     ]
     ]
   }
   }


===logout.php===
The following paragraphs document some concerns with the code in the doload() function in the loadGameBox.php file. The code in question concerns itself with manipulating the directories that contain all of the image files used by a game box. This code is complicated by two considerations. First, the PHP rename() function has a known bug that causes it to fail in certain circumstances.  This bug is documented in various places at this time [2018], including
logout.php is the server side code for the AJAX logout call.
[https://bugs.launchpad.net/ubuntu/+source/php5/+bug/723330 this launchpad bug report].
Second, BOARD18 has to be able to run in any environment including a Windows environment. This precludes using the PHP exe() command to execute shell script commands to manipulate these directories.
It will unset all of the session variables, delete the session
cookie and, finally, destroy the session.


There are no input parameters.
To deal with this situation I search the internet and found 3 PHP functions that recursively process directories.  These functions are each placed in a file of the same name as the function. The functions are rcopy($src, $dest), rmove($src, $dest) and rm_r($dir). They are documented below.<br>
<span style="color: Fuchsia">The final revision of this code turned out not to need the rmove() function. But I retained it in case this
changed in the future.</span>


Output will always be "success".
The three directories that can be manipulated by the doLoad() function are:<br>
$images - The image directory contained in the zip file.<br>
$imagedest - The game box directory that will be updated or created in the images directory for this instance of BOARD18.<br>
$imageback - A backout directory that will contain the current [old] copy of $imagedest if one exists.


===myGameList.php===
===loadBox()===
This is the server side code for the AJAX myGameList call.
loadBox validates an input zip file and sets
up the connection that doLoad will use for data base access.
It then calls doLoad to actually create the game box.
It passes on the output from doLoad.


It produces the data needed to create a list of all active
Input:
games that the signed in player is playing.
  $zfile - the zip file containing the game box to be loaded.
  $authorID - the player ID of the submitter of the game box.


There are no input parameters.
Output is the same as that for doLoad.
 
Output is the following stringified JSON data structure.
  {
    "stat":"success",
    "games":
    [
      {
        "game_id":"nnnn",
        "gname":"gggg",
        "bname":"bbbb",
        "version":"vvvv",
        "start_date":"mm/dd/yyyy"
      },
      . . . . more games . . . . .  
    ]
  }


===newUser.php===
===nextBox()===
newUser.php is the server side code for the  
nextBox creates the report object and parses the input file
AJAX newUser call. It inserts a row in the  
name. It then calls doLoad to actually create the game box.
players table to define a new player.
It passes on the output from doLoad.  


Input consists the following parameters:
Input:
   fname
   $fileName - the name of the zip file containing the game box to be loaded.
   lname
   $filePath - the path of the zip file containing the game box to be loaded.
   newuser
   $authorID - the player ID of the submitter of the game box.
   passwrd
   $webRoot - the root of the Board18 web site being loaded to.
   email
   $link - the mysqli_connect link for the BOARD18 database.


Output is one of these the echo return statuses:
Output is the same as that for doLoad.
  "success"
  "fail"
  "bademail"
  "email ''login''"
  "duplicate"


===playerGet.php===
==rm_r.php==
playerGet.php is the server side code for the AJAX playerGet call.
rm_r.php is a required module for board18BoxLoad.php.
It contains the rm_r() function.


It returns most fields for a player in the players table.
function rm_r($dir)
It also returns a list of the games the player is playing.


Input is: login.
rm_r recursively deletes a directory and all of it's contents
e.g.the equivalent of `rm -r` on the command-line.


Output is the following stringified JSON data structure.
Consistent with `rmdir()` and `unlink()`,  
<pre>
an E_WARNING level error will be generated on failure.
  {
    "stat":"success||"fail"||"nogames",
    "playerid":"nnnnnn",
    "login":"aaaaaa",
    "firstname":"bbbbbb",
    "lastname":"cccccc",
    "email":"eeeeee",
    "level":"llllll",
    "games":
    [
      {
        "gname":"gggggg",
        "status":"ssssss"
      },
      . . . . more games . . . . .
    ]
  }
</pre>


===playerShow.php===
@param string $dir absolute path to directory to delete
playerShow.php is the server side code for the AJAX playerShow call.


It returns an array of records from the players table.
@return bool true on success; false on failure


Input is: blocksz and startrow.
Modified from source code found at:  
https://gist.github.com/mindplay-dk/a4aad91f5a4f1283a5e2


Output is the following stringified JSON data structure.
==sendEmail.php==
<pre>
  {
    "stat":"success||"fail",
    "players":
    [
      {
        "login":"aaaaaa",
        "firstname":"bbbbbb",
        "lastname":"cccccc",
        "email":"eeeeee",
        "level":"llllll",
        "gcount":"nnnnnn"
        "acount":"nnnnnn"
      },
      . . . . more players . . . . .
    ]
  }
</pre>
 
===playerUpdate.php===
playerUpdate.php is the server side code for the
AJAX playerUpdate call.
 
It updates a row in the players table.
Unlike updateUser, playerUpdate keys on player_id.
 
Input consists the following parameters:
 
  player 
  login
  email
  fname
  lname
  level
 
Output is the echo return status:
  "success", "fail", "login", "bademail" or "email xxxx".
 
===snapShot.php===
This is the server side code for the AJAX snapShot call.
 
It loads game status updates into the database.
 
Input is the gameID and the operating or stock round name.
 
Output is one of these the echo return statuses:
  "success"
  "failure"
  "notplaying"
  "collision"
 
===snapShow.php===
This is the server side code for the AJAX snapShow call.
 
It returns an array of the game_snap records for this game.
 
Input is: gameid, blocksz and startrow.
 
Output is the following stringified JSON data structure.
  {
    "stat":"success||none||fail",
    "snaps":
    [
      {
        "cp_id":"nnnn",
        "round":"gggg",
        "snaper":"bbbb",
        "updater":"vvvv",
        "cp_date":"mm/dd/yyyy"
      },
      . . . . more snaps . . . . .
    ]
  }
 
===statSwap.php===
statSwap.php is the server side code for the
AJAX statSwap call.
 
It toggles the game status field in the database.
This status field can contain either "Active" or "Completed".
 
Input is the gameID.
 
Output will be "success", "failure" "notplaying" or "collision".
 
The SESS_UPDATE_COUNTER session variable is used
by statSwap.php to support optimistic database
locking. <br>This should stop concurrent updates from
messing up the database. [And do this without
incurring high overhead.]
 
===updateGame.php===
updateGame.php is the server side code for the
AJAX updateGame call.
 
It loads game updates into the database.
 
Input is the JSON game session data and the gameID.
 
Output will be "success", "failure" "notplaying" or "collision".
 
The SESS_UPDATE_COUNTER session variable is used
by updateGame.php to support optimistic database
locking. <br>This should stop concurrent updates from
messing up the database. [And do this without
incurring high overhead.]
 
===updateUser.php===
updateUser.php is the server side code for the
AJAX updateUser call.
 
It updates a row in the players table.
 
Input consists the following parameters:
  pname
  email
  fname
  lname
  passwrd (optional)
 
Output is an echo return status of:
  "success",
  "fail",
  "bademail" or
  "email ''login''"
 
===validateUser.php===
validateUser.php is the server side code for the
AJAX validateUser call.
 
It checks the current players login and password and,
if they are valid, it logs the current player in to BOARD18.
 
Input consists the following parameters:
  login
  password
 
Output will be an array containing at a minimum the named
value "stat" which will be set to "success", "fail" or an
edit failure code. If "stat" = "success" then the array
will also contain values for the following key names:
  "id"
  "firstname"
  "lastname"
  "level"
  "changeit"
 
==Include Modules==
An oveview discussion of these modules is available [[Design_Document_Server_Side_Overview#Include_Modules|here]].
===auth.php===
auth.php is included at the start of all password protected pages
and all password protected PHP programs called via AJAX.<br>
It starts a php session and then checks to see that the player is
logged in and has been active sometime in the last day.
 
===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===
sendEmail.php uses SMTP to send plain text emails.<br>
sendEmail.php uses SMTP to send plain text emails.<br>
Use configMail.php to specify the server and server access  
Use configMail.php to specify the server and server access  
information. <br>You should use the SMTP server provided by your
information. And also the MAIL_SENDER field for the specification
of reply direction.
<br>You should use the SMTP server provided by your
ISP or your hosting service for these Emails.
ISP or your hosting service for these Emails.


===makeTables.php===
Input consists the following parameters:
makeTables.php is included via "require_once()" into
login,
various board18 PHP pages.  It supplies a number of functions
subject and
for creating the HTML to display various tables on the page.
body
These tables must be displayed on initial creation of these
pages. They cannot be updated later by these functions without
reloading the entire page. This file contains these functions:
 
  showBoxes($conn) - create a table of all game boxes in database.
  showPlayers($conn) - create a table of all players in database.
  gamePlayers($gameid, $conn) - create a table of players in game.


makeTables.php initializes these variables:
Output is the echo return status of "success" or "fail".


  $theLink - value returned by mysqli_connect function.
  $open - set to an empty string if the database connect succeeded.
        - set to 'fail' if the database connect failed.


[[Category:Design]]
[[Category:Design]]

Latest revision as of 06:44, 4 October 2020

This page has been updated to comply with Release 2.7.x of BOARD18.
Design Document edit


This page has details of all of the PHP files that are included in other PHP code via the REQUIRE command.

An oveview discussion of all PHP programs 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.
If the PHP program doing the include was called via AJAX then authajax.php will be used instead of auth.php.
Otherwise auth.php will start a php session and then check to see that:

  • The player is logged on and
  • The player has been active sometime in the last 24 hours.

If either of these conditions has not been met then control will be transferred to access-denied.html.

authajax.php

If auth.php has been included by a program that was called via AJAX then it will include authajax.php and leave the work to it.

authajax.php will start a php session and then check to see that:

  • The player is logged on and
  • The player has been active sometime in the last 24 hours.

If either of these conditions has not been met then authajax.php will echo <!doctype html> and exit to the callback function.

For a better explanation of why this is done see Comment 7 in Bug 197 in BOARD18 Bugzilla.

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.

MAIL_SENDER defines the text that will appear in the "From" field of the Email. All replies will be directed here.

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

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');

loadGameBox.php

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().
The doLoad() function does most of the work but it is only called by one of the other two functions in the loadGameBox.php module.
The loadBox() function sets up doLoad when running on a web server.
The nextBox() function sets up doLoad when processing in cli mode.

doLoad()

doLoad() uses the contents of an input zip file to create a game box or to modify an existing game box.
It returns the output described below with a status and with optional report information to be emailed to the author.

Input:

 $zipFileName - the name of the zip file to be loaded.
 $zipFileLoc - the location of the zip file to be loaded.
 $authorID - the player ID of the submitter of the game box.
 $webRoot - the root of the Board18 web site being loaded to.
 $link - the mysqli_connect link for the BOARD18 database.
 $report - a response class structure to be used for the output.

Output is the following stringified JSON data structure [object].

 {
   "stat":"success"||"fail"||"nofile"||"toobig"||"email",
   "author":authorLogin,
   "rpttext":
   [
     "textline"
     "textline"
     "textline"
      . . . . .
   ]
 }

The following paragraphs document some concerns with the code in the doload() function in the loadGameBox.php file. The code in question concerns itself with manipulating the directories that contain all of the image files used by a game box. This code is complicated by two considerations. First, the PHP rename() function has a known bug that causes it to fail in certain circumstances. This bug is documented in various places at this time [2018], including this launchpad bug report. Second, BOARD18 has to be able to run in any environment including a Windows environment. This precludes using the PHP exe() command to execute shell script commands to manipulate these directories.

To deal with this situation I search the internet and found 3 PHP functions that recursively process directories. These functions are each placed in a file of the same name as the function. The functions are rcopy($src, $dest), rmove($src, $dest) and rm_r($dir). They are documented below.
The final revision of this code turned out not to need the rmove() function. But I retained it in case this changed in the future.

The three directories that can be manipulated by the doLoad() function are:
$images - The image directory contained in the zip file.
$imagedest - The game box directory that will be updated or created in the images directory for this instance of BOARD18.
$imageback - A backout directory that will contain the current [old] copy of $imagedest if one exists.

loadBox()

loadBox validates an input zip file and sets up the connection that doLoad will use for data base access. It then calls doLoad to actually create the game box. It passes on the output from doLoad.

Input:

 $zfile - the zip file containing the game box to be loaded.
 $authorID - the player ID of the submitter of the game box.

Output is the same as that for doLoad.

nextBox()

nextBox creates the report object and parses the input file name. It then calls doLoad to actually create the game box. It passes on the output from doLoad.

Input:

 $fileName - the name of the zip file containing the game box to be loaded.
 $filePath - the path of the zip file containing the game box to be loaded.
 $authorID - the player ID of the submitter of the game box.
 $webRoot - the root of the Board18 web site being loaded to.
 $link - the mysqli_connect link for the BOARD18 database.

Output is the same as that for doLoad.

rm_r.php

rm_r.php is a required module for board18BoxLoad.php. It contains the rm_r() function.

function rm_r($dir)

rm_r recursively deletes a directory and all of it's contents e.g.the equivalent of `rm -r` on the command-line.

Consistent with `rmdir()` and `unlink()`, an E_WARNING level error will be generated on failure.

@param string $dir absolute path to directory to delete

@return bool true on success; false on failure

Modified from source code found at: https://gist.github.com/mindplay-dk/a4aad91f5a4f1283a5e2

sendEmail.php

sendEmail.php uses SMTP to send plain text emails.
Use configMail.php to specify the server and server access information. And also the MAIL_SENDER field for the specification of reply direction.
You should use the SMTP server provided by your ISP or your hosting service for these Emails.

Input consists the following parameters: login, subject and body

Output is the echo return status of "success" or "fail".