UseBB Community

The official board for UseBB help and discussion

UseBB Community » Resources & Customization » [MOD] poll system

[MOD] poll system

Moderators: Gaia.

Page: < 1 2

Author Post
Member
Registered: Apr 2007
Posts: 13
Nevermind, Pizza, I'm a moron! :shock:

I forgot to enable BBCode in the post.

Boy do I feel completely stupid.
Member
Registered: Jul 2006
Posts: 36
Location: Goslar, Germany
No problem. I'm happy that I don't need to help ;)
_______________
Talking is silver, writing is gold...
Member
Registered: Nov 2007
Posts: 9
Location: Bologna (Italy)
pizza, is the latest version compatible with 1.0.8 usebb version? I can try it or it's not recommended?
_______________
Stevenking
Member
Registered: Jul 2006
Posts: 36
Location: Goslar, Germany
It should work. I can submit new patches within a few days if it doesn't work. Just try and tell me...
_______________
Talking is silver, writing is gold...
Member
Registered: Dec 2007
Posts: 1
hi
I have just started using UseBB and was trying to add the poll this topic mentions. I downloaded it and unzipped it but when I went to upload it to the server it said "The file usebb_poll_1.0.6b is not a valid UseBB module"
what am I doing wrong
thanks
hamish
Developer
Registered: Apr 2004
Posts: 2178
Location: Belgium
This is a mod, not an ACP module. You should apply the changes to the source code as described in the mod.
_______________
--Dietrich (developer)
UseBB roadmap, dev mailing list & weblog
Member
Registered: Jul 2006
Posts: 36
Location: Goslar, Germany
I have added a new version for 1.0.8. Fixes some warnings when using the patch. You don't need to install this, if you have used the old one on 1.0.8 already.
_______________
Talking is silver, writing is gold...
Member
Registered: Nov 2007
Posts: 9
Location: Bologna (Italy)
Hi Pizza, I tried your poll system ( v.1.0.8 ), but I've a problem when I post the poll. Here the code error:

In file sources/functions.php on line 1927: 

E_WARNING - mysql_num_rows(): supplied argument is not a valid MySQL result resource


1927 is the row "if(mysql_num_rows($pizza_res)>0)" in my functions.php script:

//get last choosen answer for user
$pizza_res=$db->query("select answer from ".TABLE_PREFIX."pizza_polls where memberid=\"".addslashes($session->sess_info['user_id'])."\" and postid=\"".addslashes($postsdata['id'])."\"");
if(mysql_num_rows($pizza_res)>0)
...


I checked in my forum DB and the related table is ok, but empty at the first time. Can you help me please? :roll:
You can also contact me in pvt by mail (scutone_AT_hotmail.com).
Thanks. Bye!
_______________
Stevenking
Member
Registered: Jul 2006
Posts: 36
Location: Goslar, Germany
Hi Steven ;)

The command you quoted is on line 1881 after patching a clean version of UseBB 1.0.8. An empty table cannot produce this error message. It says that something is wrong with the query.

a) Which version of UseBB have you installed and are other mods applied ?

b) Are there any errors or warnings when you apply the patch ?

c) What is the tableprefix for UseBB in your database ?

d) Please post the output of the query "desc usebb_pizza_polls;". (Replace "usebb" with your configured tableprefix.)

I think with this information it's possible to figure out what is going wrong.

Bye

Pizza
_______________
Talking is silver, writing is gold...
Member
Registered: Nov 2007
Posts: 9
Location: Bologna (Italy)
a) Yes, I use 1.0.8 version, the line is different because I've integrated some acp modules. I studied the script and the diff of your patch file, I've modified the correct line in the diff file;
b) yes, there're some errore of language, but I think they're irrilevant (however I solved this problem manually). Another error of .htaccess file, but I've modified manually and update the line with an update (|poll);
c) the tableprefix of db is "usebb_" as default, then your table is named "usebb_pizza_polls";
d) this is the output of desc query:
query SQL: desc usebb_pizza_polls;
Righe: 5
Field Type Null Key Default Extra
id int(11) NO PRI NULL auto_increment
postid int(11) NO MUL 0
memberid int(11) NO MUL 0
answer int(11) NO 0
open int(11) NO MUL 0

:'(

Pizzamampf wrote
Hi Steven ;)

The command you quoted is on line 1881 after patching a clean version of UseBB 1.0.8. An empty table cannot produce this error message. It says that something is wrong with the query.

a) Which version of UseBB have you installed and are other mods applied ?

b) Are there any errors or warnings when you apply the patch ?

c) What is the tableprefix for UseBB in your database ?

d) Please post the output of the query "desc usebb_pizza_polls;". (Replace "usebb" with your configured tableprefix.)

I think with this information it's possible to figure out what is going wrong.

Bye

Pizza
_______________
Stevenking
Member
Registered: Jul 2006
Posts: 36
Location: Goslar, Germany
This is really strange.

What happens if you send this query manually: select answer from usebb_pizza_polls where memberid="1" and postid="12" ? For any combination of memberid and postid the query should succeed without giving a result. If you get an error here, something is wrong with your database.

If there is no error I can't imagine what is wrong. To find the problem you could patch an unmodified version of UseBB and check if this works. In this case there is a problem with the poll-system and the other mods.

Please send me a tar-file of your UseBB installation so I can check the modified source (remember to remove your database-user-information). If you can upload it post the link here. Otherwise send it to spam__AT__pizzamampf.de
_______________
Talking is silver, writing is gold...
Developer
Registered: Apr 2004
Posts: 2178
Location: Belgium
Perhaps he is using mysqli and not mysql? Using mysql_*() calls in the code is dangerous, as not anyone is actually using the mysql extension with UseBB.
_______________
--Dietrich (developer)
UseBB roadmap, dev mailing list & weblog
Member
Registered: Jul 2006
Posts: 36
Location: Goslar, Germany
Very good hint, Dietrich :) Never thought a second about this :oops:

If this is the case changing "mysql_num_rows($pizza_res)" to "mysqli_num_rows($pizza_res)" in "functions.php" and "pizza_post_poll.php" should solve the problem.

Can I access the "num_rows" connection type independant like "$db->query" or have I take care of this within my code ?
_______________
Talking is silver, writing is gold...
Member
Registered: Nov 2007
Posts: 9
Location: Bologna (Italy)
I solved the problem with your council of change mysql to mysqli.. :D ;)
I was sure that I have done everything well.
Thanks for all, patch is very good! 8)

Pizzamampf wrote
If this is the case changing "mysql_num_rows($pizza_res)" to "mysqli_num_rows($pizza_res)" in "functions.php" and "pizza_post_poll.php" should solve the problem.
_______________
Stevenking
Member
Registered: Jul 2006
Posts: 36
Location: Goslar, Germany
That's fine :)

I will add a check so the script can work with both connection types...
_______________
Talking is silver, writing is gold...
Member
Registered: Jul 2006
Posts: 36
Location: Goslar, Germany
I have fixed the problem for both connection types and added the new version to the Sourceforge page.
_______________
Talking is silver, writing is gold...
Developer
Registered: Apr 2004
Posts: 2178
Location: Belgium
In fact, COUNT(*) should be used for checking the number of returned results. With v2, PDO will be used which doesn't have a proper alternative (you can only fetch the entire result set at once into an array and use count()).
_______________
--Dietrich (developer)
UseBB roadmap, dev mailing list & weblog
Member
Registered: Jul 2006
Posts: 36
Location: Goslar, Germany
I will keep this in mind if my mod is needed furthermore with version 2.
_______________
Talking is silver, writing is gold...
Member
Registered: Nov 2007
Posts: 9
Location: Bologna (Italy)
Pizza, always me :P
A request, if possible..When a user votes, I want that he can no longer vote. Is this possible?
I see that a user can continually change his vote. :?
That's too democratic according to me.... :mrgreen:
I can help you, if you want.
I expect your response..
Byez!

p.s. it could enter an option (as multi and open) with which can choose if vote can be modified, what do you think?
_______________
Stevenking
« Last edit by Stevenking on Tue Feb 19, 2008 2:40 pm. »
Member
Registered: Jul 2006
Posts: 36
Location: Goslar, Germany
It's an additional check when saving the results. Never thought about this option, because all the votes in my forums must be changeable by the user.

If I find the time I will check the days how much work it is to implement this feature...
_______________
Talking is silver, writing is gold...
Member
Registered: Jul 2006
Posts: 36
Location: Goslar, Germany
I have added a "nochange"-option to the poll in version 1.0.8b.

Furthermore I added some checks to ensure that the user cannot override the poll-layout with manipulated post-variables. I think this is necessary now with the new option.

The new version should be fully compatibel with old polls.

@Stevenking: Testing and feedback is greatly appreciated to ensure that there is no problem introduced with this change.
_______________
Talking is silver, writing is gold...
Member
Registered: Nov 2007
Posts: 9
Location: Bologna (Italy)
Hi Pizza, sorry for late :mrgreen:
I've just tried your modifications of pool system, and that's ok! I've manually modified the code of scripts as descripted into diff file so I can't give you the assurance that it goes well with diff patch, but I think it's not a problem.
Good works! Just one note: after vote, you've disabled the "Send" button, I think that you can disable the selection box too, after vote it's useless according to me.. :P
Thanks for all one more time! :D
_______________
Stevenking
Member
Registered: Jul 2006
Posts: 36
Location: Goslar, Germany
Stevenking wrote
Just one note: after vote, you've disabled the "Send" button, I think that you can disable the selection box too, after vote it's useless according to me.. :P
Thanks for all one more time! :D


Oh yeah. That's right. Will keep it in mind for the next release :mrgreen:

Stevenking wrote
Thanks for all one more time! :D


You are welcome :)
_______________
Talking is silver, writing is gold...

Page: < 1 2

UseBB Community » Resources & Customization » [MOD] poll system

UseBB Community is powered by UseBB 1 Forum Software