Affordable Web Hosting with Excellent Customer Support internet connection free month hosting

netConsole: SurveySays

SurveySays is an interactive voting program which enables you to provide polls and surveys on your website.

By providing polls and surveys for your visitors to vote in, you not only add an element of fun to your site, you also become more aware of your visitors tastes and opinions.

This script supports multiple installations, can be customized to match the look of your website, and can be configured to prevent users from voting more than once.

Three examples of the SurveySays script, in the form of a Spam Email Survey, a Hosting Survey, and a Domain Name Survey are all available for you to see.

Between the three demos, you can get a good idea of how the survey script can be modified. The first demo, Spam Email Survey, has been customized so that there is not a graphical representation of the results. This was done by setting the $GRAPHICAL variable to 0. The second demo, Hosting Survey, has been configured with the $WITHOUT_VOTE variable to be 0. This prevents the user from seeing the results unless they first vote. The last demo, Domain Name Survey, is only customized in regards to the colors used in the survey and results. All other variables are the default settings.

Complete details on configuring SurveySays appears in the Additional Configuration Options section below.

Installing SurveySays

SurveySays is installed from the Package Installer section of your netConsole. Once you select "surveysays" from the drop-down menu and click the install button, you'll be prompted for the directory in which you wish to install the program.

button, you'll be prompted for the directory in which you wish to install the program.

The directory you specify must be located within your webshare directory, for example if you enter /webshare/poll, netConsole will install the script-related files into a directory called "poll" within your webshare directory. If the directory you specify does not exist, the netConsole will create it.

It is important to know that by installing SurveySays into an existing directory containing files, you run the risk of overwriting any files in the directory with the same names as any script-related files. Therefore, we recommend you install the script into empty directories only.

Setting Up SurveySays

This section discusses initial configuration; the minimal amount of work needed to get SurveySays up and running on your site. Further configuration will be covered in the next section.

After installing the script, the first step in setting up SurveySays is to edit the script supplying the survey name, the survey question, and the possible answers to the survey question. You may either edit the script directly on the server using SSH and vi, or you may choose to download the files via FTP and edit them on your local machine.

If you choose to edit the files locally, we recommend you employ a simple text editor such as Windows Notepad, MacOS' SimpleText or Vi/VIM for *nix systems.

Once you have the file open in your editor, scroll down to line 58 which looks like this:

my $POLL_NAME = "SurveySays v2.0";

Replace the default survey name, SurveySays v2.0, with whatever you'd like. Try to limit the name to 2-3 words. Next, locate line 77, the survey question:

my $QUESTION = "What is your favorite color?";

and replace it with your question. Then, scroll down again until you are on line 82, the possible answers for your question.

my @CHOICES = ("Red","Green","Blue","Mauve","Eggshell");

Again, replace the default values with your own. At this point, you've made the minimum number of modifications necessary to use the script. Upload the modified script to the server via FTP in ASCII format and verify it has the correct permissions: 0755.

The last step necessary involves editing the web page that the survey will be displayed on. Surveysays is a CGI script that is called or included into a web page using Server Side Includes (SSI). To make the web page capable of running a CGI script such as this, you must rename your .html or .htm file to use the file-extensions .shtml, .shtm or .sht. For example, index.html should be renamed index.shtml. Don't forget to update your links after making this change.

Next, at the location in the web-page where you would like the survey to appear, add the following text code to your HTML:

<!--#exec cgi="/path-to/"-->

Once you've done this, the page will then display the voting script.

Additional Configuration Options

Surveysays has many configuration options which allow you to modify the way the script looks, the way the results are displayed, whether or not users can vote more than once and much more.

If you have multiple survey scripts installed, you must provide a unique code for each. This variable is used as the name of the optional voting cookie, discussed below, as well as for telling which poll is being voted on. It should be short, alphanumeric, and unique from other instances of this script.
This is the "name" of your poll. It should only be a few words long.
These variables control the look of your poll. $TOP_COLOR is the color at the top of the poll, where the $POLL_NAME will be. $BOT_COLOR is the background color for the section of the poll that contains the answer choices. $FONT_COLOR is the color the text will be, and $FONT_SIZE is how big it will be. $FONT_FACE controls the font that is used by the poll. $TABLE_WIDTH controls how wide your poll will be.
This variable is the question you are asking in your poll.
Represents the possible answers people can give. It should be formatted as shown.

my @CHOICES = ("Red","Green","Blue","Mauve","Eggshell");

Represents the background colors for the graph bars. The first color is used for the whichever choice is top-most on the results page. The second for the second top-most and so on. The values for this array can be in either hexidecimal or plain text:

my @COLORS = ('#FF0000', 'white', '#0000FF');

If $GRAPHICAL is set to 1, a 'bar graph' of sorts will be printed along side percentages when the results are shown. Set this value to 0 to report only percentages with no bars.

$GR_FILE is the URL to call the 1 pixel x 1 pixel transparent image that is used to create the bars. Use of a transparent GIF allows the color of the results bars to be controlled by the @COLORS array. If you replace this image with another, all of the bars will be the color of your new image.

$GR_HEIGHT is the height in pixels the bar should be, and $GR_SCALE helps control the width (when set to 1, an answer with 25% of the vote would have a bar 25 pixels wide; if set to 2, 25% would yield a 50 pixel bar and so on).
There are several ordering options for displaying results. If this variable is set to 'given' they will be ordered as they are in @CHOICES. If set to 'low' they will be ordered from low to high. If set to 'high' they will be ordered from high to low (which is also the default).
If you want the total number of votes received to be reported with the results, set this to 1. Else, set it to 0.
If you'd like to only display results after a certain number of votes are cast, set this variable that number. Set it to 0 (zero) if you'd like to always display the results.
The script has two ways of checking for people who have already voted. One way is by setting a cookie. The other is by keeping track of the IP addresses votes are cast from. To use both, set this variable to 'all'. To use cookies only, set it to 'cookie'. To use IPs only, set it to 'ip'. I recommend setting it to 'all' -- neither method is 100% effective, but the combination of them is pretty good.
This variable should be set to the number of IP addresses to remember, if # using IP checking. I recommend between 5 and 10.
If you are using cookies, the following two variables must be set. $COOKIE_REALM should likely be "" using your domain name. $COOKIE_DAYS should be set to the number of days to wait before the cookie expires.
If the browser doesn't send the "HTTP_REFERER" variable, which is pretty common, the script won't know by default where to redirect to. Setting this to the URL that the poll is viewed at allows the script to continue working.
This variable, if set to 1, may help alleviate problems with browsers and proxy servers caching your page and not displaying poll results.
This variable, if set to 1, adds a text link to the poll, which allows the user to see the poll results without voting.
Once you are done with a poll, you can set $ARCHIVE to 1 so that the poll only returns results when called, and cannot be voted on. Note that this is ridiculously inefficient -- you should simply load the poll, save the HTML code, and use that.

Related Items