What is InstantPoll.cgi? InstantPoll.cgi allow you to offer Polling to your web visitors. People can vote and instantly see where the voting results are in real time. The script uses cookies to discourage multiple voting. This script uses a server-side include implementation. You must have the ability to use the following SSI command Also add the following tags to the 'end' of the HTML file. Between the and tags.
(Trust me on this. IE has a bug in how it works with the cache. If you put this at the top of the HTML page, IE will cache the page.) If you are using Apache – you will need to tell Apache this file needs to be scanned for SSIs. Put a .htaccess file in the same directory and put the following in the .htacess file: AddHandler server-parsed poll.html Replace pool.html with the name of the html file. If you are using Netscape – make sure that the page is named .shtml instead of .html. Create an ASCII file under the name of your Poll. E.g. PollOne. Put the following info into the new file: (Make sure you set the Poll file permissions to 644. UNIX filenames are case sensitive.) CallingPage|/full/path/to/page Question|Who is the best player of the 90's? Answers|3 1|Jerry Rice|/www/path/to/image|0 2|Barry Sanders|/www/path/to/image|0 3|John Elway|/www/path/to/image|0 Total|0 FontFace|Arial Expires|7-26-1999 BackGroundColorHeader|#FFFFCC BackGroundColorBody|#FFFFCC HeaderStart|August Question HeaderResults|August Results (Make sure you separate the 'key' and 'value' with a '|' or pipe.) CallingPage – enter in the full path to the page that is calling the InstantPoll.cgi e.g. /web/sites/foo.com/sub1/sub2/page.html. Question – enter in the Question you want to ask the reader. Make it short and sweet. Answers – enter in the number of possible answers to the question. 1,2,3 – number each possible answer. Enter the possible answer, the web path to the image to use for the polling result color bar, and a zero result to start with. All separated with a pipe '|'. (Note: you can create a very small one color GIF file 50 pixels by 15 pixels for each answer's result or use the same image for all answers.) Total – should be set to zero to start with. FontFace - Enter in the font you want the text to display in. Expires – Enter in the expiration date of the poll. After this date the poll Question will not be shown anymore, only the results. No Expiration Data means the poll never expires. Make sure you use a 4 digit date for the year and '-' separating the numbers. BackGroundColorHeader, BackGroundColorBody – enter in the #000000 color code for the table background color. Header will be used for the first and last table rows. Body will be the table's default back ground color. HeaderStart, HeaderResults – This is the text in the table. Start is the first text the user sees at the top of the Question table. Results is the first text the users sees in the Results Table. What the Script Does… When the web serer opens the page is scans each line for SSI commands. Straight HTML is passed to the browser and when it encounters an SSI, it stops parsing the HTML file and launches the program. Any output from the launched program is sent to the browser. When the program is done running, the server continues scanning the HTML to the end of the file, sending HTML to browser and launching any other SSIs it encounters. When launched via SSI, the script does some error checking then looks for a cookie from the Browser. If there is a cookie, it prints the results of the poll. If there is no cookie, it prints out the Question Form. When the script is launched via the Form, it does some error checking then looks for a cookie from the Browser. If there is a cookie or no answers selected, it prints the results of the poll ignoring the Form answers. If it passes the checks, it opens the Poll File and increments the totals for the selected answer and for the Total answers collected. Then prints the results of the poll. Note: When called via the Form, to print the results of the poll – the script reads the 'calling page' (entered in the Poll File) and substitutes the SSI command with the results of the poll. That's why you don't need to have an answers page. Adding a New Poll To change out a Poll or start another poll. Create a new Poll file following the rules outlined "Setting Up InstantPoll.cgi". Edit the calling page and change the "Poll= " SSI command to the new poll file. Mae sure you use a new Poll File name, since the cookies are set with the Poll File name. That's it. Misc. This program uses cookies. If a user is not allowing cookies they will be able to vote more than once. Also if they know how to erase cookies, they will be able to vote more than once. Lastly, cookie expiration times are set to the expiration date of the poll.