Poll plugin - cookie problem

Creating and modifying plugins.
Post Reply
Mr. Sark

Poll plugin - cookie problem

Post by Mr. Sark »

Hello,

i have a problem using poll plugin. All seem to work well, except cookie saving/writing. For some reason, I can vote again whenever I re-run browser and go to the poll page.

Can anyone help me out pls?

Thanks,
Alen

Poll location:
http://www.kosko.si/
(it's the one in the very bottom of right sidebar, named "test poll"
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Poll plugin - cookie problem

Post by garvinhicking »

Well, you modified the javascript code:

Code: Select all

<script type="text/javascript">
        function SetPollCookie(name, value) {
            var today  = new Date();
            var expire = new Date();
            expire.setTime(today.getTime() + (60*60*24*30));
/*            document.cookie = 'serendipity[' + name + ']='+escape(value) + ';expires=' + expire.toGMTString(); */
	var cookie_name = "FuckYou";
	document.cookie = "FuckYou=FuckFuckFuck; expires=Fri, 21 Oct 2005 23:59:59 GMT;";
        }

		SetCookie("pollHasVoted2", "true");
        </script>
Then serendipity cannot properly set the cookie...

Best regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Guest

Post by Guest »

My mistake, it was after it wasnt setting it properly, i started testing where it would be the problem, if it's in setting the name, expiration, etc. I'll put the original code back, and if you can check again, i'd be more than grateful.

Thank you,
Alen
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

The error was in the common.inc.php file of the plugin - there the javascript calls "SetCookie" instead of "SetPollCookie". IF you correct that, it should work.

I committed the fix to version 2.05 of the plugin!

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Mr.Sark

Post by Mr.Sark »

Well, what else can I say, but, I love you ...

Thanks for helping me out m8

Alen
Post Reply