ASP Football Pool

Version 4.0

Copyright 1999-2015 by Mike Hall».

Table of Contents

  1. License and Disclaimer
  2. Description
  3. Requirements
  4. Pool Formats
  5. Additional Features
  6. How to Set Up Your Pool
    1. Configure Your Pool Settings
    2. Code Your Email Function (Optional)
    3. Upload the Files and Test the Database Connection
    4. Test Your Email Function (Optional)
    5. Invite Some Friends to Play
  7. Running Your Pool
  8. Adding Custom Styles and Scripts
  9. Support
  10. Release Notes

I. License and Disclaimer

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 3 of the License, or (at your option) any later version. This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program. If not, see».

This software includes a copy of TinyMCE», used under the GNU Library General Public License. See the LGPL license for more details.

This software is intended for recreational use only. It is not affiliated with the NFL or any NFL team.

II. Description

This web application allows you to host a weekly pick'em football pool for your friends, family and co-workers. It is designed to be easy to set up and run.

In addition to weekly pools you can run a survivor and/or margin pool and up to three different postseason pools.

A designated Administrator manages the pool doing things like setting point spreads, updating the schedule and entering scores. The Administrator also manages user accounts and can update the home page with news, announcements, etc.

III. Requirements

This application is designed to run on Internet Information Server (IIS) web servers, using Active Server Pages (ASP) and a Microsoft Access database. To host it, your web server must support ASP and have the appropriate database drivers installed.

You may also need the ability to modify directory permissions on your site in order to allow updates to the database. Check with your hosting provider to ensure your site meets these requirements.

Some ASP programming knowledge is required in order to use the email notification feature. ASP has no built-in functionality for sending email. However, most hosting services provide some facility for sending emails via script. To make use of whatever your host provides, you will need to add the appropriate code as described below.

IV. Pool Formats

Here is a brief description of the available pools and options.

Weekly Pool

Each week, players enter by guessing the winner in each of the week's games. Whoever scores the highest in that week wins. Players are also asked to guess the total number of points that will be scored in the Monday Night game (or whatever the last schedule game of the week is). In the event of a tie, the player or players who guess closest to that total win.

You can choose to use point spreads, in which case players must pick teams to win against the spread, rather than straight up.

You can also choose to use confidence points, where players must rank each pick from one to however many games there are that week. Players are scored by totaling the points assigned to each correct pick.

Overall Award(s)

You can choose to reserve a portion of each week's pot to go towards an overall award given at the end of the regular season. There are one or two awards, the first going to the player with most total correct picks. If you use confidence points, there is a second award for the player who scores the most total points.

You set the amount as a percentage of each weekly pot. The size of the award will depend on the total number of entries for each weekly pool. When using confidence points, you can specify how this total award will be split between the two categories (correct picks and total points). For example, you can split them 50-50 or give 60% to the player with the most points and the remaining 40% to the player with the most correct picks.

Should more than one player tie for one of these awards, it is split evenly among them.

Survivor/Margin Pool

This pool is separate from the weekly pools and runs the length of the regular season. In either pool (or in the combined pool) players are asked to pick one team each week and cannot use any team more than once.

Survivor Pool

Each week, if a player's chosen team wins, the player continues on to the next week. If the player's chosen team loses, the player is eliminated (you can choose whether to count a tie game as a win or a loss). The last player left standing wins.

Should all active players be eliminated in a given week, they are automatically reinstated and continue on to the next week. If more than one player survives the entire season, the number of correct picks is used as a tiebreaker.

If desired, you can configure this pool to allow two or more losses before elimination. It also supports buybacks, where eliminated players can get back into the pool for a fee.

Margin Pool

Unlike the survivor pool, players are not eliminated for losing picks. Instead, the goal is pick the team that will win by the most points each week.

When a player's team wins, the number of points the team won by is added to his or her total. When a team loses, the player's total is deducted by the number of points the team lost by. The player with the highest total score at the end of the regular season wins. Should two or more players tie for the highest score, the number of correct picks is used as a tiebreaker.

Optionally, you can choose not to deduct points for a losing pick. Instead, the player will receive zero points for that week.

Combined Survivor/Margin Pool

You can also combine the survivor and margin pools. Players pick one team each week and that team is used in both pools. Even if a player is eliminated from the survivor pool, he or she continues making picks for the margin pool.

You can specify how to divide the pot between each pool. For example, you might award 75% to the winner of the survivor pool and give the remaining 25% to the margin pool winner. If you allow players to buyback into the survivor pool, those fees are not included in the split. Instead they are added to the calculated survivor pot.

Note: By default, the survivor, margin or combined pool begins on the first week of the season. You can set it to start on a later week, if desired.

Playoffs Pools

There are actually three separate playoffs pools. You can run any combination of these you like. Note that there is no tiebreaker in any of these pools, players tied for the highest score will split the pot evenly.

Playoffs Pick'em Pool

This pool is similar to a weekly pool except that it covers all the postseason games. If point spreads and/or confidence points were used in the weekly pool, they will be used in this pool as well.

Playoffs Rank'em Pool

For this pool, players rank each of the playoff teams using confidence points. These ranking must be submitted before the first playoff game starts. Everytime a team wins a playoff game, players have whatever points they've assigned to that team added to their total score. The player with the highest total score after the final game is played wins.

Super Bowl Pool

This one is based on propositions, specific statistics and events concerning the big game. Players answer a series of questions in the form of "which team will:"

The player who gets the most correct wins.

Over two dozen different propositions are provided by default but as the Administrator you can add, remove or replace any of them with your own.

The application includes help pages that explains the pool rules in more depth. They automatically tailored to cover the specific pool options you have set. Be sure to read the special Administrator sections on those pages before attempting to run a pool.

V. Additional Features

Some additional features include:

VI. How to Set Up Your Pool

Please carefully review all the following steps before attempting to install the Football Pool on your own web site.

1. Configure Your Pool Settings

The includes/config.asp file contains several constant definitions that you will need to customize.

Note: When first installing your site, you might want to start with the defaults provided, except for the DATABASE_FILE_PATH setting which must be properly set for the application to access the database. Set that and then follow the remaining set up steps to ensure that everything is running. Once you're sure it's working, you can go back and configure the rest.

Site Settings

' Site settings.

'Session timeout (in minutes).

'Site URL, used for the emails sent to users.
const POOL_URL = ""

'Page title.
const PAGE_TITLE = "2015 Football Pool"

'Administrator email address.
const ADMIN_EMAIL = ""

'Flag indicating whether the server can send email or not.

'Sign up invitation code.

'Time zone difference between host server and database schedule (Eastern).
const TIME_ZONE_DIFF = 0

'Location of the database.
const DATABASE_FILE_PATH = "./data/NFL.mdb"

'For best performance, leave false unless the server does not have the Jet
'OLE DB provider installed.

'Key used for encrypting private data.
const DATA_ENCRYPTION_KEY = "4k0s*b92mqld:pdw7d4sklda8adz@d{a"

'Session variables.
const SESSION_MESSAGE_KEY  = "SK_Message"
const SESSION_THEME_KEY    = "SK_Theme"
const SESSION_USERNAME_KEY = "SK_Username"

Determines how long a user can remain idle before being automatically logged out.

Set this to the web address of your pool.

This is used on the top banner and title of all pages. Each individual page also has a subtitle.

Set this to the email address you'd like players to use to contact you.

Indicates whether email send capability is available or not. If your host does not permit you to send email via ASP set this to false. Email notifications will not be available in this case and there will be no email confirmation for user sign ups.

Note that in most cases, in order to use these email features you will need to customize some code as described below to suit your site.

You can use this to restrict user sign ups. If left as an empty string, anyone may use the sign up page to create a user account.

To prevent just anyone from signing up, you can set this to a simple character string (e.g., a four-digit number, a password, etc.) which you would then give out to those you wish to invite to the pool. Users trying to sign up will be required to enter that string on the sign up form. Note that if used, the invitation code is case-sensitive.

Set this to compensate for the time zone difference between your web server and the Eastern time zone. For example, if your web server is located in the Central time zone, set the value to -1. If your web server is located in the Pacific time zone, you should set the value to -3

This is used to set up the database connection. Initially, the database file (NFL.mdb)is located in a subdirectory named data. If you move or rename that database file, you will need to update this constant accordingly.

You may specify either a full path (e.g., C:\sites\username\databases\NFL.mdb) or a relative path (e.g., ..\..\databases\NFL.mdb)

Note that some hosts provide a specific location on their server for you to place databases. If that is the case, you are strongly encouraged to store the NFL.mdb file there and set this value accordingly for improved security. Be sure to check with your hosting provider to determine the proper location.

This should generally be set to false unless you encounter an error like that described below.

This character string is used to encrypt and decrypt private user data (email address, contact information, etc.) It is recommended that you change this key so that it is unique to your installation. Any string of 20 to 40 random characters will do.

These are used for various ASP Session variables. Normally, you can leave them alone. But, if you have multiple instances of the pool installed on your site, you should define a unique name for each.

Display Settings

' Display settings.

'Enable team themes flag.

'Show point spreads flag. Used to display the line even if picks are not
'made against the spread.
const SHOW_POINT_SPREADS = false

'Show team logos flag.
const SHOW_TEAM_LOGOS = true

'Text string used when displaying the Super Bowl in playoffs schedules.
const SUPER_BOWL_INFO = "XLV - Cowboys Stadium - Arlington, TX"

Setting this to true allows users to select a specific team theme. Note that you'll have to use a theme that includes individual team themes.

This setting only applies if you have USE_POINT_SPREADS set to false. Setting this to true will cause point spreads to be displayed on entry forms even if they are not used for picks. It will also allow quick picks (if enabled) to be made using the spread.

If true, team logos will be displayed next to the team names. If false, only the team names will be displayed.

This text string is used when displaying the Super Bowl on the playoffs schedule (which is available only when at least one playoffs pool has been enabled). It's merely informative but obviously changes from year to year so it's included here for easy modification.

General Pool Settings

' General pool settings.

'Hide other players picks until the games are locked flag.
const HIDE_OTHERS_PICKS = true

'Use confidence points flag (weekly and playoffs pick'em pools).

'Use point spreads flag (weekly and playoffs pick'em pools).
const USE_POINT_SPREADS = false

If true, players cannot see picks made by other players until they have been locked. The Administrator can still see all picks, however. If false, players can see other player's picks as soon as they are made.

This applies to the weekly and playoffs pick'em pools. If true, players must assign confidence points to each pick. The point values range from one to the number of games that week (or the total number of playoffs games) and each point value can be used only once. The player's score will be the total of the points assigned to each correct pick. If false, a player's score is simply the number of correct picks he or she made.

Again, this applies to the weekly and playoffs pick'em pools. If true, the outcome of each game is based on a point spread, set by the Administrator. If false, picks are straight-up.

Weekly Pool Settings

' Weekly pool settings.
' Note: You can include an overall award based on total picks (and if
' confidence points are used, there will be a second overall award based on
' total points). A portion of each weekly pool will be reserved for the
' overall award(s).

'Cost of a weekly pool entry.

'Allow tie picks flag.
const ALLOW_TIE_PICKS = false

'Enable quick picks flag.
const ENABLE_QUICK_PICKS  = false

'Enable overall award(s).

'Amount to take from each weekly pool towards the overall pot. This is a
'percentage of the total weekly pot.

'Amount of pot that goes to the player with the most overall confidence
'points. (Applies only when confidence points are used, the player with the
'most overall correct picks gets the remainder.)

The cost for each weekly entry, in dollars.

If true, any games that end in a tie will only count towards a player's score if the player actually picked a tie for that game. If false, players may not pick games to end in a tie. Instead, all players will receive half the normal points awarded for a correct pick on any game that ends in a tie.

When set to true, players will be able to use the quick picks feature when making weekly entries. This feature allows a player to pick all the games with a single click based on options such as all home teams, all favorites, etc. It will also enable players to set their own personal team rankings which can be used for quick picks. If confidence points are used, players will be given similar options to quickly assign points to their picks.

Set to true to enable overall award(s). There are either one or two overall awards which are given after the final weekly pool is complete. One goes to the player(s) with the most correct picks over the entire regular season. If confidence points are used, a second award goes to the player(s) with the most total confidence points scored over the entire regular season.

This value determines what percent of each weekly pool's pot is reserved for the overall award(s). For example, if set to .05, 5% of a given weekly pot is reserved for the overall award(s) while the remaining 95% is paid to the winner(s) for that week. It should be a number between zero and one.

Applies only if confidence points are used. This value determines how much of the overall award goes to the total points winner(s). For example, if set to .60, 60% of the overall pot goes to the total points winner(s) while the remaining 40% goes to the total correct picks winner(s). This should be a number between zero and one.

Survivor/Margin Pool Settings

' Side pool settings.
' Note: You can choose to play this as a survivor pool, a margin pool or
' a combination of both. In a combined pool, users pick a single team each
' week and that pick applies to both pools.

'Enable survivor pool flag.

'Enable margin pool flag.
const ENABLE_MARGIN_POOL = false

'Cost of a survivor/margin pool entry.
const SIDE_ENTRY_FEE = 50

'Starting week of the side pool.

'Amount of pot that goes to the survivor pool winner(s).
'(Applies only when a combined survivor/margin pool is used, the winner(s)
'of the margin pool get the remainder.)

'Number of losing picks that will eliminate a player.

'Count a tie game as a losing survivor pick flag.

'Maximum number of time a player may buy back into the survivor pool.
'(Set to zero to disable buybacks.)

'Cost of a buyback.

'Last week players will be permitted to buy back into the suvivor pool.
'(Set to zero for no limit.)

'Deduct points on a losing margin pick flag.
'Note that when true, if a player does not make a pick then the largest
'margin among all the week's games will be deducted.

Set to true to enable the survivor pool.

Set to true to enable the margin pool.

Note that if both pools are enabled, it is considered a combined survivor/margin pool. Players pay one entry fee for this combined pool and make one pick each week which will be applied toward both pools. You will want to set SIDE_SURVIVOR_SHARE (see below) to determine how to split the pot between the two pools.

The entry cost for the side pool, in dollars.

The week that the side pool begins. This is useful if you initially disabled the side pool but decide to include it after the season has begun.

Applies only if you combine the survivor and margin pools. This value determines how much of the total pot is awarded to the winner(s) of the survivor pool. The remainder will be awarded to the winner(s) of the margin pool. For example, if set to .50, the pot will be split evenly between the two pools. This should be a number between zero and one.

For the survivor pool, this number determines how many incorrect picks it takes to eliminate a player. Setting it to one means a player is eliminated with a single losing pick, setting it to two means a player is eliminated on their second losing pick, etc.

Set to true to count a tie game as a loss in the survivor pool. If set to false, tie games will be counted as a win.

You can allow eliminated players to get back into the survivor pool for a fee using this setting. Set to 1 to allow one buyback per player, 2 to allow up to two buybacks, etc. Setting this to zero effectively turns off the buyback option.

The cost of a buyback. All buyback fees go into to the survivor pool pot. If your are running a combination survivor/margin pool, these fees are applied after the split (defined by SURVIVOR_POT_SHARE). In other words, they do not affect the margin pool pot.

This determines the last week a player may use the buyback option. Note that regardless of what is set here, buybacks may not be used once the pool has been won. Set to 0 to allow buybacks up to the final week.

If set to true, players will lose points in the margin pool when their pick loses. Note that if a player does not submit a pick for a given week, their score will be deducted using whichever game had the greatest scoring difference that week. Setting this to false means that players will receive zero points for a losing or missing pick.

Playoffs Pools Settings

' Playoffs pick'em pool settings.

'Enable playoffs pick'em pool flag.

'Cost of a playoffs pick'em pool entry.

' Playoffs rank'em pool settings.

'Enable playoffs rank'em pool flag.

'Cost of a playoffs rank'em pool entry.

' Super Bowl pool settings.

'Enable Super Bowl pool flag.

'Cost of a Super Bowl pool entry.

Set this to true to make the playoffs pick'em pool available. Note that the playoffs pick'em pool is played much like a regular weekly pool. If the weekly pool is set to use point spreads and/or confidence points, this playoffs pool will use them too.

The entry cost for the playoffs pick'em pool, in dollars.

Set this to true to make the playoffs rank'em pool available.

The entry cost for the playoffs rank'em pool, in dollars.

Set this to true to make the Super Bowl pool available.

The entry cost for the Super Bowl pool, in dollars.

Message Board Settings

' Message board settings.

'Enable message board flag.

'Define maximum message length allowed.

'Define the number of days to keep posts. Set to zero to keep posts
const MAX_POST_AGE = 30

'Define the maximum number of posts to keep (when this limit is exceeded,
'the oldest posts will be removed first). Set to zero to keep an unlimited
'number of posts.
const MAX_POST_COUNT = 250

'Number of posts displayed per page.
const POST_PAGE_SIZE = 10

Set to true to enable the message board. If set to false, users will not be able to post or view messages.

By default, messages posted on the message board are removed after a certain number of days, or if the total number of messages exceeds a certain limit. There is also a limit on the size of any one message. All this is intended to keep the database from growing too large and possibly impacting performance. You can adjust these limits to suit your particular installation.

Defines the maximum number of characters that can be used in a single post. Note that this includes HTML markup characters.

Defines the maximum number of days that a post will be kept. Posts older than this will be deleted.

Defines the maximum number of posts that will be kept in the database. When this limit is reached, posting a new message will cause the oldest post in the database to be removed (regardless of its age).

This simply defines how many posts will be shown per page when viewing the message board. It does not affect the size of messages or how long they are kept.


' Add-ons.
' Note that these components rely on external web sources and are subject
' to changes with those sources. If problems occur, you can disable them
' here.

'Enable online payments (via PayPal) flag.

'Online payment settings.
const PAYPAL_BUSINESS       = ""
const PAYPAL_ITEM_NAME      = "2015 Football Pool"

'Number of log entries to display per page.

'Enable live scoreboard and scores loader flag.

This add-on allows players to submit payments via PayPal». Note that you must have a PayPal account to use this feature. It's a good idea to get a developer account» so you can test your set up before attempting to accept real payments.

PayPal charges a processing fee for handling payments (currently, that fee is 2.9% of the payment plus $0.30). The code is set up to take that fee into account. For example, to receive $50.00 in credit towards the pool, a player will be asked to pay $51.80. The extra $1.80 will appear as a shipping charge on the payment.

To use this feature, you'll need to configure the following as well:

The final setting is PAYPAL_LOG_PAGE_SIZE which defines how may items to show per page when viewing the online payment log.

This add-on generates a live scoreboard display on the site pages (which users can hide the display if desired). It also adds functionallity to Administrator's scores update page to look up scores online and prefill the form fields.

2. Code Your Email Function (Optional)

The includes/email.asp file contains a function stub named SendMail(). This is intended to programmatically send emails to players, such as when a new user signs up or when the Administrator sends email notifications regarding point spreads updates, scheduling changes, etc.

Because each web host is different, you'll need to edit this function to provide working code for your particular installation. Check with your host provider regarding how to send email via ASP. Most provide sample code which you can tailor to your needs. If your host does not provide this functionality, set the SERVER_EMAIL_ENABLED option to false in your configuration settings.

Your implementation should use the function arguments defined in the code stub. It should return an empty string if the email was successfully sent or an error message if it fails.

Below is an example using CDOSYS (commonly found on Windows servers) showing how to use the function arguments and set the return a value:

function SendMail(toAddr, subjectText, bodyText)

  dim mailer
  dim cdoMessage, cdoConfig

  'Assume all will go well.
  SendMail = ""

  'Configure the message.
  set cdoMessage = Server.CreateObject("CDO.Message")
  set cdoConfig = Server.CreateObject("CDO.Configuration")
  cdoConfig.Fields("")  = 2
  cdoConfig.Fields("") = ""
  set cdoMessage.Configuration = cdoConfig

  'Create the email.
  cdoMessage.From     = ADMIN_USERNAME & " <" & ADMIN_EMAIL & ">"
  cdoMessage.To       = toAddr
  cdoMessage.Subject  = subjectText
  cdoMessage.TextBody = bodyText

  'Send it.
  on error resume next

  'If an error occurred, return the error description.
  if Err.Number <> 0 then
    SendMail = Err.Description
  end if

  'Clean up.
  set cdoMessage = Nothing
  set cdoConfig  = Nothing

end function

3. Upload the Files and Test the Database Connection

Upload all files to your web site. You should then be able to browse to the site and login as the Admin using the default password admin.

If not, the problem is probably with the database connection. Check that you set the database file path correctly in step 1 and that the database file has been uploaded to that location.

If you see an error like the following:

Error Type:
Provider (0x80004005)
Unspecified error

Try setting USE_ACCESS_ODBC_DRIVER to true in your configuration settings.

If you still encounter problems, check with your host provider. They may have specific requirements for setting up a database connection, such as storing the database in a special location, defining a datasource name, etc. If that is the case, make the necessary configuration changes and/or move the database. In some cases, you may need to modify the OpenDB() subroutine in the includes/common.asp file to comply with your host requirements.

Once you have the database connection working, login as the Admin and try updating the database, say by adding a new user or changing your password. If you see an error similar to this:

Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Microsoft Access Driver] Operation must
use an updateable query.

It means you'll need to set up access permissions for the database file. Again, this is host-specific so check with your provider regarding how to set permissions to allow your database to be updated by a web application.

4. Test Your Email Function (Optional)

If you've set your pool up to use email, you can test it by first editing the Administrator profile to add a working email address and check the "New announcements" notification option. Then go to the "Edit News" page, check the "Send update notification to users." option and click on Save.

If all is well, you should receive an email at the address you specified within a few minutes.

5. Invite Some Friends to Play

Once installed and tested, you can start inviting your friends to play.

You can either manually add users (don't forget to give them whatever password you have assigned to them) or direct them to the sign up form (remember to give them the invitation code, if you specified one in the pool configuration).

VII. Running Your Pool

The pool administrator has several duties that must be performed during the course of the season:

Be sure the check all the help pages that come with the pool. When logged in as the Admin, you'll find additional notes in them regarding administration.

The pool was designed to be a fun, friendly diversion for all participants to enjoy. Keep it fair, be open and responsive to your players and it should be just that.

VIII. Adding Custom Styles and Scripts

The includes/custom.asp file is designed to let you to customize your pool without having to edit the existing pages. You can use it to add your own stylesheets and JavaScript code to pages.

<% 'Add custom styles and scripts below. %>

The contents of this file are included after all the other styles and scripts on each page (just before the closing <head> HTML tag) so you can easily override or add to the existing stylesheets and code.

Anything you place here will normally be added to every page. But, if you want to customize a specific page, you can do so with some server-side code by checking a global variable named CurrentScriptName which will contain the file name of the current page.

As an example, say you wanted to add a custom style sheet to all pages and add some in-line JavaScript code to just the Login page. The code would look something like this:

<% 'Add custom styles and scripts below. %>

    <-- Include this style sheet on all pages. -->
    <link rel="stylesheet" type="text/css" href="styles/myCustomStyles.css" />

<% 'Add this JavaScript code to the login page only.
    if CurrentScriptName = "userLogin.asp" then %>

    <script type="text/javascript">//<![CDATA[

      // My custom code...


<% end if %>

Now every page will include the myCustomStyles.css stylesheet but only the userLogin.asp page will have your JavaScript code.

IX. Support

For additional help and updates, visit these sites:

X. Release Notes