CyberGL
search in CyberGL only
1 Visitor, 0 Member logged in
Signup Activation Login

phpSurvey ver 0.0.2 Documentation

General Information

Please read the INSTALL file for installation instructions.

After completing the installation you'll be greeted with welcome page. There is menu on left side bar with 4 links, they are "Home", "Guide" (you reading it now), "Create" and "Tool". "Home" is the welcome greeting page, "Create" is a form page to create new polls, the form consist of 3 form-field.

  1. Description => Polls description, usually the thing you'd want people to vote for.
  2. Options => Number polls options, home many option do you want on the polls.
  3. Response URL => This is URL which voter will see after they make a vote.

The last one is optional, but the two first is mandatory. After full filling the form click "Next" button and you'll see form to create poll option. Every option has an order, the option will appear by this order.

After creating a poll, you'll redirected to page "Tool", you can see there your new poll listed with an ID and links to edit, del, vote and view the result. Link "Vote" and "Result" will print out a sample snippet on how to integrate this poll into your website. The poll ID plays an important role as it is used to identify the poll you want to let people vote for.

Configuration

Database configuration

$db_user is the username of your database.
$db_pass is the password of your database.
$db_name is the name of the database where application can find its tables.
$db_host is the hostname of the MySQL database.

Tables configuration

$tbl_survey_poll is the name of the polls description table
$tbl_survey_option is the name of the polls options table

Path configuration

$rootpath is the directory path where you installed the application
$reqpath is the directory path where application can find its required modules
$incpath is the directory path where application can find its include files

URL configuration

$rooturl is base URL where you can browse the application
$voteurl is the vote.php3 URL's, it will use as action in the voting form
$imageurl is the URL where images can be browse

Voting configuration

$prevent is a flag that determines whether application should check for a user voting twice by setting a cookie. If this flag is set to 1, application will send cookies and check them every vote. If the flag is set to 0, no cookies will be issued nor will any checks be performed.

Integrating the phpSurvey into your code

You can integrate a poll-voting form by inserting code snippet which you can obtain by clicking the link 'Vote' at tool.php3 page. To integrate a poll result into your code, you have to include config.php3 and survey.php3 into your script. These files are in your phpSurvey-require-installation-directory or simply insert code snippet which you can obtain by clicking the link 'Result' at tool.php3 page.

phpSurvey provide two functions to get poll result.

string read_poll(int poll_id);

poll_id is ID of the poll which you can find at the tool.php3 page.

This function return a string contains the poll description.

array read_vote(int poll_id);

poll_id is ID of the poll which you can find at the tool.php3 page.

This function return an associative-array with 5 key-elements which describe below.

  1. title => option title
  2. percent => vote percentage.
  3. vote => vote amount of the current option
  4. pixel => a value which you can use to the width parameter in the image tag (graphic stat)
  5. total => total amount of the vote

This function return sequential poll-option on every call of this function. Call read_vote()-function as many as number of the poll-option, it will returns a series of the poll-option. 

Login Form
Login:
Password:
Lost Password?