Forums / Cotonti / Core Labs / Ideas / Slight improvement for poll / vote

ToM
#1 2011-01-04 18:06
I have the idea to slightly improve the poll plug-in.

This improve a bit the poll plug-in because sometimes ID or IP is not enough.
Sometimes two different users could have the same IP but you don't want to cut the guests from the vote.
You can set "id then ip" for this case.

1.
-------

EDIT:
(into file) functions.admin.php:

function sed_loadconfigmap()
{
$result[] = array ('polls', '02', 'ip_id_polls', 2, 'ip', array('ip','id','id then ip')); // N-0.0.2

}

2.
------

ADD:
(into file) polls.functions.php (into the function) function sed_poll_vote() and (into the function) function sed_poll_form($id, $formlink='', $skin='', $type=''):


elseif($cfg['ip_id_polls']=='id then ip')
{
if ($usr['id']>0)
{
$sql2 = sed_sql_query("SELECT pv_id FROM $db_polls_voters WHERE pv_pollid='$id' AND pv_userid='".$usr['id']."' LIMIT 1");
}

else
{
$sql2 = sed_sql_query("SELECT pv_id FROM $db_polls_voters WHERE pv_pollid='$id' AND pv_userip='".$usr['ip']."' LIMIT 1");
}

$alreadyvoted = (sed_sql_numrows($sql2)==1) ? 1 : 0;
}
Salvation is the gift but sometimes is to hard for us to acknowledge it.
esclkm
#2 2011-01-04 23:41
May be use only one way?
littledev.ru - мой маленький зарождающийся блог о котонти.
снижение стоимости программирования и снижение стоимости производства разные вещи. Первое можно скорее сравнить с раздачей работникам дешевых инструментов, чем со снижением зарплаты
ToM
#3 2011-01-05 16:58
I'm sorry maybe I'm not understand your question well but now the situation one IP two Users and Guests allowed to vote can't be handled by Cotonti poll plug-in now. If you add the stuff above you are able to handle the situation well.
Salvation is the gift but sometimes is to hard for us to acknowledge it.
GHengeveld
#4 2011-01-05 17:20
Yes I think its a good idea. Actually I think it should be the default behavior.