Its time to improve our polls system.
So I guess everyting what we need is in Polls.module.php file.
Im not stong programmer of cmsms, but I think It would be much easier when we have the code.
Make them eat the cookie: line 274:
Code: Select all
if (session_id()=="") session_start();
$q="INSERT INTO ".cms_db_prefix()."module_pollblocked (sessionid,votetime,pollid) VALUES (?,?,?)";
it could be sth like this:
Code: Select all
setcookie ($this->GetPollName($pollid), "", time() + 60*60*24*30); // cookie with pool name and time to live
Code: Select all
function UserAlreadyVoted($pollid) {
$db=&$this->GetDb();
$q="SELECT * FROM ".cms_db_prefix()."module_pollblocked WHERE pollid=? AND sessionid=?";
$p=array($pollid,session_id());
$result=$db->Execute($q,$p);
if (!$result || $result->RecordCount()<1) {
return false;
} else {
return true;
}
}
Code: Select all
function UserAlreadyVoted($pollid) {
if (isset($_COOKIE['$this->GetPollName($pollid)'])
{
return true;
}
else {
return false;
}