[Snippet] easyPoll
Started by Cris D., Dec 12 2007 09:46 AM
8 replies to this topic
#1
Posted 12 December 2007 - 09:46 AM
File Name: easyPoll
File Submitter: Cris D.
File Submitted: 12 Dec 2007
File Category: Feedback / E-Mail Forms
Snippet: easyPollV1.0
Date: 2007/12/12
Author: Cris D.
For: Etomite 0.6.1.4
Use: Allows users to vote on custom options and displays the results in a fully configurable graph.
############## Installation Instructions ####################
1) Create two folders under assets called 'graph' and 'img' ie assets/graph/img
2) Upload the postgraph_poll.class.php file to the graph folder.
3) Save the contents of the easyPoll.txt in your snippet library,
call it whatever you want eg "easyPoll".
4) Call this snippet [!easyPoll!} in an uncached page.
5) Configure the snippet for your personal use and requirements.
6) div classes used for CSS:
div.success{} div.error{} div.emailForm{}
See here for a live demo (email addresses are not stored).
Click here to download this file
File Submitter: Cris D.
File Submitted: 12 Dec 2007
File Category: Feedback / E-Mail Forms
Snippet: easyPollV1.0
Date: 2007/12/12
Author: Cris D.
For: Etomite 0.6.1.4
Use: Allows users to vote on custom options and displays the results in a fully configurable graph.
############## Installation Instructions ####################
1) Create two folders under assets called 'graph' and 'img' ie assets/graph/img
2) Upload the postgraph_poll.class.php file to the graph folder.
3) Save the contents of the easyPoll.txt in your snippet library,
call it whatever you want eg "easyPoll".
4) Call this snippet [!easyPoll!} in an uncached page.
5) Configure the snippet for your personal use and requirements.
6) div classes used for CSS:
div.success{} div.error{} div.emailForm{}
See here for a live demo (email addresses are not stored).
Click here to download this file
#2
Posted 12 December 2007 - 01:55 PM
Is there any way to stop multiple voting?
Also, is the e-Mail address field protected against injection?
Also, is the e-Mail address field protected against injection?
#3
Posted 12 December 2007 - 08:26 PM
Quote
Is there any way to stop multiple voting?
It was written to allow multiple votes, but this could be stopped by using sessions, or more checking for the existence of the email address used in the table before a record is saved, not too hard to do.
Quote
Also, is the e-Mail address field protected against injection?
A good question, it checks for the email being a valid domain first and if not, returns an error message. I was thinking that this would have been enough to stop malicious data being saved to the table, I did not consider an header injection (an oversite I know). I will have a look into it a bit more. Thanks for the heads up.
#4
Posted 29 March 2008 - 03:49 PM
I've got this error: http://www.prdi.cz/test2
"SQL" said:
CREATE TABLE `prefix_easypoll_votes` ( `id` INT(100) NOT NULL AUTO_INCREMENT, `choice` VARCHAR(100) NOT NULL, `email` vARCHAR(100), `tstmp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP , PRIMARY KEY (`id`) ) TYPE = myisam
#5
Posted 29 March 2008 - 07:06 PM
churchyard, on Mar 30 2008, 01:49 AM, said:
I've got this error: http://www.prdi.cz/test2
CREATE TABLE `prdi_easypoll_votes` `id` INT(10) NOT NULL AUTO_INCREMENT, `choice` VARCHAR(100) NOT NULL, `email` VARCHAR(100), `tstmp` TIMESTAMP NOT NULL DEFAULT CURRENT_TIMESTAMP, PRIMARY KEY `id`;
Perhaps your server needs the database name sent too? Anyway if you try this directly in phpMyAdmin it will give you more specific error messages to look at anyway.
#6
Posted 29 March 2008 - 10:58 PM
Perhaps prefix_easypoll_votes was the problem... $etomite->dbConfig['prefix'] can be used to get the prefix...
#7
Posted 30 March 2008 - 06:47 AM
The snippet uses:
The error posted above is not the same as the error in the link, the link seems like a valid prefix.
@churchyard, is the prefix in the link to your web site error correct for your table? "prdi_"?
If so, there is another issue besides the prefix being returned.
$etoPrefix=$GLOBALS['table_prefix']; //etomite_The fact that the $tableCheck returns false and not an error connecting to the database it uses extTableExists() tells me that the $GLOBALS are not the problem and a valid prefix (and all other connection params) is being returned (unless the code has been modified).
The error posted above is not the same as the error in the link, the link seems like a valid prefix.
@churchyard, is the prefix in the link to your web site error correct for your table? "prdi_"?
If so, there is another issue besides the prefix being returned.
#8
Posted 04 October 2008 - 01:49 AM
How do I turn the email verification off. The site is private and I just want people to just click and vote. Also is there a way to display the numbers of votes in a text form along with the graph ?
Thanks for a great contrib. and you help
Thanks for a great contrib. and you help
#9
Posted 04 October 2008 - 10:29 AM
@mike_e: This snippet was written specifically to collect email addresses and therefore (unfortunately) this part of the code is pretty ingrained. HAving said that, it's also pretty easy to remove it by:
1)Change
To return just text lables and their values would be easier to write code for that purpose using getIntTableRows and a bit of logic instead of hacking this snippet which was written for a very specific output (the postgraph class).
1)Change
if (isset($_POST['send_email']) && $_POST['send_email'] == 'sent'&& isset($_POST['elf'])) {
to something along the lines of if($_POST['elf']){
to remove any email address validation and adjust the logic to continue to save the record to the table and change the form so that no email inputs are returned.To return just text lables and their values would be easier to write code for that purpose using getIntTableRows and a bit of logic instead of hacking this snippet which was written for a very specific output (the postgraph class).
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











