Firefox PHP

Module: Topic Poll

Posted by Maurice Makaay 
Re: Module: Topic Poll
July 16, 2010 03:22PM
A blank screen normally indicates a serious PHP-issue, causing the script not to continue running. In such case, it is extremely helpful to check out the error log of the webserver to see if a PHP error is logged.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Module: Topic Poll
July 21, 2010 12:06AM
Other than Apache2.2/logs/error.log and access.log. Is there any other log file I can look into
because I don't get anything in error.log and I only got the following in access.log.

127.0.0.1 - - [21/Jul/2010:12:00:04 +0800] "POST /phorum-5.2.15a/read.php?76,7486 HTTP/1.1" 200 23994
127.0.0.1 - - [21/Jul/2010:12:00:05 +0800] "GET /phorum-5.2.15a/css.php?76,css HTTP/1.1" 304 -
127.0.0.1 - - [21/Jul/2010:12:00:06 +0800] "GET /phorum-5.2.15a/css.php?76,css_print HTTP/1.1" 304 -
127.0.0.1 - - [21/Jul/2010:12:00:06 +0800] "GET /phorum-5.2.15a/javascript.php?76 HTTP/1.1" 200 114129
127.0.0.1 - - [21/Jul/2010:12:00:14 +0800] "POST /phorum-5.2.15a/read.php?76,7486 HTTP/1.1" 500 -
Re: Module: Topic Poll
July 21, 2010 04:16PM
There could be a separate PHP error log, where PHP errors are sent to. This is hosting-dependent, so please contact your hosting provider to see if they have setup this kind of error logging.

You can also try to enable the event logging module and trigger the error that you see. The even logging code might also catch and log the error, in which case you would not need the server error log.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Module: Topic Poll
August 10, 2010 10:35AM
Quote
loveclaire
I installed topic_poll-1.0.18 on Phorum v5.2.15a. I created a poll and voted successfully. But when I logged in as different user and voted, it always go to a blank screen and the vote was submitted to database base. Help please.

Maybe I have a solution for you.
I use Phorum on our intranet server and I never planned on letting anyone register on his/her own. So I imported the necessary data from another database and removed the possibility for registration.
However some employees do not have an email address. When I tried to cast a vote logged in as one employee without email address in phorum_users the whole thing crashed.
After looking in the apache error.log I found that topic_poll.php calls phorum_api_user_save() to save the vote.
Now when no email is saved in the database you get an error from the phorum_api_user_save() in /include/api/user.php
line 537 - 544

There might be other possible problems but this could be your problem too.

BTW: My employer wanted anonymous votes so I changed the way phorum rembers whether someone voted or not anyway. Now I save the md5 hash of the user_id in a new table and just look for it when it is necessary to validate if the user already voted. The point is I only know whether he/she has voted but not how they voted.
Seems rubbish but the votes are about serious stuff and we might get into trouble here... you know in Germany they take employee survaillance and privacy really sirious.

Hope I could help and thanks for the great work!
Greets Bernd
Re: Module: Topic Poll
August 10, 2010 10:49AM
Thanks for the extensive report, Bernd. Interesting to read about your use of the module. Maybe something that could be useful for implementation in a future version of the module.

What's in the MD5 that you save? Only the user_id? That would not be too useful. Are you storing a combination of the message_id and the user_id in an MD5 hash or so? I would probably go for a simple table that had the message_id and the user_id in it. That would also make it possible to do some other queries on the database (e.g. for finding all polls for a user that he/she did not vote for).


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Module: Topic Poll
August 10, 2010 03:19PM
Well so far I store the md5 of the user_id and the message_id. Saving the user_id plain this way is also more or less anonymous but only after a few votes have been cast. Of course one can easily use brute-force and create all md5s out of the user_ids but I just assume that the admins are trustworthy.

Let me test my solution a while. I will send you the code but so far it is not compatible with other databases.
I will think about your idea to create such queries. Might be useful in the future. I need more "real deal" tests. Actually I thought about deleting old polls so searching for them would be useless... but there might be votings in the future which last a long time. we´ll see ;-)
Re: Module: Topic Poll
August 10, 2010 04:40PM
With trustworthy admins, storing the message_id + user_id should be good enough. Cracking the MD5 would only cost a few lines of code. I don't think that a script would have to run really long to get all user-message relations from the MD5 sum. You'd need a really slow server or a huge amount of polls + users to make that a bit slower.
Storing the user_id and message_id still only reveals that the user has voted. The exact vote is not recorded. Wouldn't that be anonymous enough already?

Additionally, there's always the (tiny) risk of MD5 collisions, although I'm not sure if those would happen with this specific use.

I hope these thoughts are useful for you. Even without my considerations, I think that you've taken a working approach, so it's mostly conceptual mumbling from my side ;-)


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Module: Topic Poll
August 19, 2010 01:43PM
HI!

Where can i test this module?
Re: Module: Topic Poll
August 19, 2010 02:04PM
Ideally in your own setup. But if you want a sneak preview, then feel free to play around at my dev server.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Module: Topic Poll
August 19, 2010 02:32PM
Thank you for your helping!

Is it possible for this module voting for posts?
Sorry, only registered users may post in this forum.

Click here to login