PHP Contest Scoreboard
version 3

Readme

Welcome to PHP Contest Scoreboard. This script allows you to run contests on your web site. Set your question(s), wait for the entries to roll in, then mark the contest by clicking on the correct answers, or by entering keywords. Our brand new interface makes all of this a piece of cake!

Setup

You will have already unzipped the files you downloaded. The main files of interest are:

index.php
The main admin file. Setting up new contests and marking is done here.
config.php
Contains global variables and functions.
contest.php
Displays the entry form for the current contest. You will need to point your visitors here to enter the contests.
leaderboard.php
Displays all the players scores, in descending order.

Open config.php in a text editor (e.g. Notepad) and change any desired core variables. These are:

$scoreboard['password']
The password used for the admin section. This must be changed to stop unauthorized users messing with things.
$scoreboard['site_name']
Your site name. This is displayed in the pop-up windows for the contest form and leaderboard, if you decide to use them.
$scoreboard['contest_points']
The number of points to be awarded per correct answer (default: 1).

Finally, upload all the files to your web server. You may need to CHMOD the files in the data folder to 666 to make them writable (you can do this in your FTP client).

You're now ready to roll! The set-up and marking process is very simple, but you can continue reading for more detailed documentation and customization...

 

New contest

To start a contest, point your web browser at the location of the index.php file. Enter the new password you have chosen, then click "Start a new contest". (If there is a contest already running you need to close it first; see below.)

Enter your question in the box. You can add more questions by clicking the "Add another question" button. Click "Finish" to finalize the questions and start the contest.

To allow your visitors to enter the contest, you need to include the submission form. The easiest way is to point visitors to the contest.php file. A pop up window is a nice way to do this, which you can create with the following code:

<a href="scoreboard/contest.php" onclick="window.open('scoreboard/contest.php', 'window', 'scrollbars=yes, resizable=yes, width=790, height=550');return false;">Play the contest!</a>

Make sure to replace both instances of contest.php with the real path to the actual file.

There is also the option of adding the form inline with your own PHP web page so that it wil fit in with your design. Add the following code wherever you want the form to appear. (Again you'll need to set the correct path to the contest.php file.)

<?php
$display_inline = true;
include 'scoreboard/contest.php';
?>

The default look of the inline form is plain, to allow you to add your own CSS to it. If you don't know any CSS or need some hints as to what styles to apply, take a look at the "Form styles" section of stylesheet.css. The contest form had ID contest and contains two fieldsets and some labels/inputs.

Marking

Marking the contest is quick and easy. Log into the admin section and you will see two buttons (assuming a contest is running). The first is "Mark current entries". This allows you to mark some of the entries without closing the contest, meaning you can mark in increments instead of all at once (useful for popular websites). The second button is "Close contest & mark". This should be obvious: it closes the running contest (preventing any new entries) and allows you to mark remaining entries.

Marking is done one question at a time. To mark an entry as correct, just click it. Click it again to revert to incorrect. There are also "Select all" and "Select none" buttons - the former is useful for reverse marking (deselecting answers that are inforrect).

You can also mark many entries at once using our innovative Quick mark system. Simply type a keyword in the box at the top of the page (case insensitive), click "Apply" and every answer containing that keyword will be marked as correct!

If you chose "Close contest & mark", the leaderboard will be updated atfer marking.

Leaderboard

What fun is a regular contest without a tally of total scores? The file leaderboard.php displays all players and their total points, in descending order. You can launch it in a pop-up window with this code:

<a href="scoreboard/leaderboard.php" onclick="window.open('scoreboard/leaderboard.php', 'window', 'scrollbars=yes, resizable=yes, width=790, height=550');return false;">View the leaderboard</a>

As with the contest form this can be displayed inline with your page with the following code:

<?php
$display_inline = true;
include 'scoreboard/leaderboard.php';
?>