config.php
1: <?php
2: /****************************************************************************
3: * DRBPoll
4: * http://www.dbscripts.net/poll/
5: *
6: * Copyright � 2007-2009 Don B
7: ****************************************************************************/
8:
9: require_once(dirname(__FILE__) . '/class.php'); // For the Poll class definition
10:
11: // Modify this string to reflect the URL where DRBPoll is installed.
12: // A trailing slash must be included. This URL will be used in the generated
13: // HTML for the URL for the form submission. This may be a relative or
14: // absolute URL.
15: $POLL_URL = 'poll/';
16:
17: // Names of the form input elements in the poll form.
18: // You probably won't need to change these unless the names conflict with some
19: // other element on your pages.
20: $POLL_ID_PARAM_NAME = "pollid";
21: $VOTE_PARAM_NAME = "vote";
22:
23: // Maximum width of a bar of the poll results, in pixels
24: // Change this if you want to make the poll bar chart larger
25: // or smaller in width.
26: $MAX_POLL_BAR_WIDTH = 200;
27:
28: // Whether or not the script should prevent the same IP address
29: // from voting multiple times on the same poll.
30: // Set to FALSE to allow duplicate votes.
31: $PREVENT_DUPLICATE_VOTES = FALSE;
32:
33: // Whether or not vote counts should be displayed.
34: // If set to FALSE, only the percentages will be shown.
35: $SHOW_COUNTS = TRUE;
36:
37: // These are the strings that are displayed in the poll control
38: // and the result page.
39: // Modify these to customize what is displayed to the user.
40: $SUBMIT_BUTTON_STRING = 'Submit';
41: $NUMBER_OF_VOTES_STRING = 'Total votes: %s';
42: $VOTE_STRING = 'Vote:'; // Used as label for combobox control type
43: $VOTE_LIST_DEFAULT_LABEL = 'Please Select'; // This is the "empty" option when using a combobox
44: $VIEW_RESULTS_STRING = 'Current Results';
45: $DUPLICATE_VOTE_ERROR_MSG = 'You have already voted!';
46: $NO_VOTE_SELECTED_ERROR_MSG = 'You forgot to select a value!';
47:
48: // List of valid polls. All vote requests are checked against this list
49: // to ensure that malicious users do not submit invalid poll IDs through a
50: // cross-site request forgery.
51: //
52: // Add or modify the $VALID_POLLS array to add, modify, or remove polls.
53: // The key of the $VALID_POLLS associative array represents the poll ID;
54: // this value must be a string. In addition, it must only use alphanumeric
55: // characters (A-Z, a-z, and 0-9).
56: //
57: // Set the question property of the Poll object to a string representing
58: // the question to be displayed.
59: //
60: // Call add_value() on the Poll object to add a new value. The first
61: // parameter represents the value ID, which must be a alphanumeric string.
62: // The second parameter is the string to display to the user for this value.
63:
64: $VALID_POLLS = array(); // The keys of this associative array are the poll IDs
65:
66: // First poll definition
67: $p = new Poll;
68: $p->question = "What is your favorite color?"; // Question displayed to the user
69: $p->returnToURL = "../example.php"; // Specify the URL to return to for this poll; may be relative or absolute
70: $p->legend = "First Poll"; // Form legend; leave empty for none
71: $p->control_type = $CONTROL_RADIOBUTTONS; // Control type; $CONTROL_RADIOBUTTONS or $CONTROL_COMBOBOX
72: $p->add_value("1", "Red"); // Poll value ID and a display string
73: $p->add_value("2", "Green");
74: $p->add_value("3", "Blue");
75: $p->add_value("4", "Yellow");
76: $VALID_POLLS["1"] = $p; // "1" is the poll ID
77:
78: // Second poll definition
79: $p = new Poll;
80: $p->question = "How old are you?"; // Question displayed to the user
81: $p->returnToURL = "../example.php"; // Specify the URL to return to for this poll; may be relative or absolute
82: $p->legend = "Second Poll"; // Form legend; leave empty for none
83: $p->control_type = $CONTROL_COMBOBOX; // Control type; $CONTROL_RADIOBUTTONS or $CONTROL_COMBOBOX
84: $p->add_value("1", "0-15 years"); // Poll value ID and a display string
85: $p->add_value("2", "16-20 years");
86: $p->add_value("3", "21-30 years");
87: $p->add_value("4", "31-40 years");
88: $p->add_value("5", "41-50 years");
89: $p->add_value("6", "50+ years");
90: $VALID_POLLS["2"] = $p; // "2" is the poll ID
91:
92: // Third poll definition
93: $p = new Poll;
94: $p->question = "What is your favorite PHP script?"; // Question displayed to the user
95: $p->returnToURL = "../example.php"; // Specify the URL to return to for this poll; may be relative or absolute
96: $p->legend = "Third Poll"; // Form legend; leave empty for none
97: $p->control_type = $CONTROL_RADIOBUTTONS; // Control type; $CONTROL_RADIOBUTTONS or $CONTROL_COMBOBOX
98: $p->add_value("1", "PHP Guestbook", "http://www.dbscripts.net/guestbook/"); // You may include the optional URL parameter to create a link
99: $p->add_value("2", "PHP Poll", "http://www.dbscripts.net/poll/");
100: $p->add_value("3", "PHP Image Gallery", "http://www.dbscripts.net/imagegallery/");
101: $p->add_value("4", "PHP Ratings", "http://www.dbscripts.net/ratings/");
102: $VALID_POLLS["3"] = $p;
103: ?>