Download SportsPHool


Installation Guide

Table of Contents

bullet Requirements
bullet Install & Setup
bullet Auto-install
bullet Manual install
bullet Configuration
bullet Security
bullet Administration
bullet Formatting
bullet Playing


You'll need a Web server with PHP v4.03+ and a MySQL database v3.23.20+. Recommended PHP is 4.03pl1 or newer and MySQL 3.23.37 or newer. PHP will need to be configured with session and MySQL support; and, you will need GD support to use the player charts. SportsPHool also requires the ADODB database abstraction library and the PHPlot library. Recent versions of these libaries are bundled with the SportsPHool application (currently ADODB 1.40 and PHPlot 4.4.6); however, you may choose to use a newer version if you wish.

SportsPHool should run regardless of whether you have transparent SID's enabled, or the users have cookies enabled. If you have difficulties with SportsPHool after installation, consult the Support resources at SportsPHool's Sourceforge site.


Upload all files in the root SportsPHool directory and the admin, assets and includes subdirectories to your Web server (do not upload the manuals subdirectory). Make sure you upload the .html, .php, .css and .js files as ASCII and the various image files as binary.


From your Web browser, run the setup.php script. The first step in the installation process is to choose a location for the configuration file. Since this script will hold your database variables, location can be important. (See the Security section below.) A default location of your main SportsPHool directory is suggested. If you change this value, be sure to use the full system path. Click "On to Step 2=>" and you'll be able to enter your configuration information.

See the configuration section for a full description of all the configuration variables. Various defaults will be set, but you can change any of these. Once you've entered all your configuration variables, click "Save configuration..."

If you don't see any error messages, and you see the success message, you are ready to run SportsPHool. Before doing so, DELETE SETUP.PHP FROM YOUR WEB SERVER!. Browse to your main page (for example:, click the Register/Sign On link, log in as an existing user using the Administrator username and password you chose in setup step 2, and you're ready to roll! See the Admin Manual for instructions on running SportsPHool.

Manual install

Edit manuals/sample.config.php with the values necessary to run your application. See the configuration section for information on the variables listed in this file. Rename the file to whatever you wish and upload it to your server. Edit shared.php to point to your new configuration file (line 3, $configfile = "";).

Edit manuals/maninstall.sql and change the table names to begin with the prefix you placed in your config file. Change the username, fullname, password and email for user #1 in the INSERT statment for the {prefix}Players table. Upload the new .sql file to your server and run it on your MySQL server with:
mysql -hhost -uusername -p database < /path/to/maninstall.sql


These are the configuration values you will need to enter

bullet Name of site: the site name as you would like it presented in the title bar and page header (examples: "SportsPHool", "Pigskin Prognosticators").
bullet Site slogan: a slogan for your site, e.g. "For sports PHanatics everywhere!".
bullet Table prefix: a code to prepend to all table names to avoid conflicts with other tables that might be held in the same database, or use it to run more than one SportsPHool installation from the same database.
bullet URL to site: the main URL to your site; do not use a trailing slash (e.g. or; the default filled in by the setup script should be correct.
bullet URL to admin site: the URL to your admin pages, this will generally be your main site URL with /admin added; however, you can move it to a different directory or even a different domain!
bullet URL to assets: the URL to the directory where your images, stylesheets and JavaScript source files will be held; the default of your main site domain with /assets added is acceptable.
bullet Filesystem path to site: this is the full computer system path to your Web site, e.g. /usr/www/users/username/sportsphool or c:\Inetpub\wwwroot.
bullet Filesystem path to includes: the full computer system path to the include files, the default of main path plus /includes is acceptable.
bullet Name of HTML layout: the name of the HTML/CSS templates that will be used for creating each page; the Formatting section below has more information on how this is used.
bullet Use DST?: Whether or not to use Daylight Savings Time (or whatever your country calls the summer time adjustment); the Admin Manual has more information on how this works. For manual installs, this value should be either TRUE or FALSE (or 1 or 0).
bullet DST start time: the time the system should start making DST adjustments, in YYYY-MM-DD format; e.g. 2001-10-28 02:00. For manual installs, this value is stored as a UNIX timestamp.
bullet DST stop time: the time the system should stop making DST adjustments, in YYYY-MM-DD format; e.g. 2002-04-02 02:00. For manual installs, this value is stored as a UNIX timestamp.

Hours of DST offset: the number of hours by which times should be adjusted during DST, e.g. -1 or 1. For manual installs, multiply the number of hours by 3600 to get the total number of seconds difference.

A few notes on DST: if using DST, you should adjust it for the season during which your sports will be played. For example, the NFL begins during DST in the US and ends during Standard Time. So the system should view DST as beginning in October with an adjustment of -1 and when setting up the NFL games, you would use -4 as the default offset from GMT. This will give you a time offset of -4 for all games prior to 10/28 and -5 for all games on or after 10/28. See the Admin Manual for more information on how DST affects the games. (If it all sounds too complicated, just don't use it.)

bullet Ties count as win? whether or not to count tie games as a win. If you say "Yes" here, every player would score a point for a tie game. For manual installs, use -1 (negative one) for wins, 0 (zero) for no win.
bullet Width of team logos: if you will be using team logos and they are all a standard size, enter the width here; your pages will dislpay faster.
bullet Height of team logos: if you will be using team logos and they are all a standard size, enter the height here; your pages will dislpay faster.
bullet Database server name: the name of your database server, e.g. localhost or
bullet Database user name: the user name with which you access your database.
bullet Database user password: the password with which you access your database.

Database name: the name of the database where you will be storing SportsPHool information.

Note: if the username/password combo above does not allow creation of databases, you will need to manually create the database (or have your ISP create it for you) before running the setup script. The username/password combo you use for the database must have create/drop table access as well as normal select/insert/delete/update access.

bullet Administrator full name: your full name.
bullet Administrator email: your email.
bullet Administrator user name: a user name you will use for administering SportsPHool.
bullet Administrator password: a password you will use for administering SportsPHool.


The following is not a treatise on security; however, it should serve to make your Sports PHool installation less prone to hackers.

  1. Move your admin directory

    Even though the admin scripts are password-protected by SportsPHool, for greater security, you can move the admin directory; it can even reside in a different domain; although, it must still be on the same physical server. This will help defeat anyone trying to find the admin script. If you do move the admin directory, you will need to edit index.php in that directory to point to the proper location of shared.php.

  2. Run your scripts under your user ID (wrapped)

    This is a smart thing to do with all scripts, especially if you are on a shared server. Ask your Web host or consult your Web server documentation for information on running your scripts wrapped. If you are able to do this, you can change the permissions of all .php files so that only you have access to them. (Under *nix, this would be chmod 700 on all .php files.) Be sure to leave any .html, image, .css, or .js files accessibe to the Web server (e.g. chmod 707).

  3. Move config.php outside the Web tree

    You can place your configuration file outside the directory structure accessible to the Web server (e.g. to your home directory). Be sure to put the correct path in during the setup process. You can also, of course, give the config file a different name to help hide it from potential hackers.


Administration of Sports PHool is covered in the Administrator's Manual.


The primary content of Sports PHool is generally produced in tables. This content is wrapped by two files (a header and footer). Additionally, a navigation menu file is needed, and a CSS file is optional. Header, footer and navigation files are placed in the layout subdirectory of the includes directory. The CSS file is in the assets directory. The names of the files are determined as follows:
Name of layout (from config file) + (.header/.footer/.mainnav/.mainstyle) + (.php/.css)

When creating new files, use this naming scheme. So, for example, for a format named "myformat", name your files myformat.header.php, myformat.mainnav.php, myformat.footer.php, myformat.mainstyle.css; and place them in the appropriate directories.

You can work off the existing files to create new formats, but there are a few things to keep in mind.

bullet The header must start the BODY of the page, and it must include the call to the CSS file (if desired) and the call to the writelocal.js file.
bullet The mainnav file must be included either in the header or footer (or both). This file is not called from each script, so leaving it out of one of the other two files will leave your visitors without navigation.
bullet No formatting is specified within the main content of Sports PHool! Tables are produced with class attributes for alternating rows, and various other classes are specified for special output. Any style added to this content will have to come from a CSS file. See the default.mainstyle.css file for comments on how to produce CSS for the main content. You can, of course, style the header, footer and mainnav in any way you like.
bullet The mainnav file contains some programmatic checking to make the menus context specific. Be sure, when styling this file, that you do not destroy the code flow.
bullet There is no requirement to keep the "Powered by Sports PHool" ad in the footers.


Information on playing Sports PHool is located in the player help files accessed from links within the main program.


SourceForge Logo     PHP Hypertext Preprocessor    MySQL Database