vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   Member Archives (https://vborg.vbsupport.ru/forumdisplay.php?f=202)
-   -   [RELEASE] Poll Hack v1.0.1 (https://vborg.vbsupport.ru/showthread.php?t=4386)

11-03-2000 03:40 PM

[EDIT] Some users found a badley-coded part of the hack, I am rewriting that part and therefore have deleted the url from this post[/EDIT]

The Poll Hack for the vB, now updated for speed and fuctionality. Demo at http://www.naboonline.com/polltest/

new features from 0.9.2 (previous version)

- if a user votes without logging in, is asked to login and the pollvote still counts
(2 new templates,error_pollvotenologin, error_pollvoteinvaliduser)
- Graphical view of poll results available. Template pollyesvote has a new variable $pollbargraph. If you
do not want to have the graphical view, simply remove the variable.
- poll icon ist now not needed to be inserted into the vBulletin icon db.
- new file pollmodule.php - hacks in files only reference to it, much less code to enter into the new files!
- speed enhancements and less mysql calls.

Overall features

- Let registered users post a new thread that has a poll integrated in it
- Let registered users vote on the poll
- Multiple votes impossible as userid is stored on vote
- Define # of poll options in CP
- Limit who can post a poll by usergroups (from the control panel)
- Designed to be easily translated. Only some text is hard coded (see localisation section below)
- Fully templateable - you can customise the look of the poll
- Users who can not post can not vote as well
- Make sure person did not vote, press back, and vote again
- Admin/Moderator edit of Polls at all times
- Edit Poll while no votes (for user who started the poll thread)
- vB code parse for options
- closing a thread == close a poll
- Admin delete
- View results without voting
- Close a poll (admin/mod/author)
- Graphical view of votes (bar graph and/or pie graph) **NEW**

Note to upgraders: Due to a change in the how data is stored, the new poll is not backwards compatible. Therefore, you will need to run updatepoll.php

The poll hack will be intergrated into vBulletin 2.0, so if you are in no hurry, you should better wait ;)


[Edited by doron on 11-04-2000 at 06:00 AM]

11-03-2000 04:27 PM

Hey doron, does this work with 1.1.4?

11-03-2000 04:30 PM

yes, there is a special 1.1.4 install file (notes114.txt) which details installing it on 1.1.4. the polltest forums run 1.1.4 now.

11-03-2000 04:31 PM

I'll install it on my test board then! (I love playing with new stuff). Unfortunately since the PM hack isn't compatible with 1.1.4, I can't go live with that version :(

But I'll let you know if I come across anything!!

11-03-2000 06:34 PM

Hello Doron,

Thank you very much for your efforts.

I am getting a couple of errors:
  • The poll shows twice on the poll page
  • Even though the user is already logged in it asks them to login again...then when the user does it gives them a database error.
This is the database error I receive when the user trys to login...even though they are already logged in:
Quote:

Database error in vBulletin: Invalid SQL: SELECT threadid FROM post WHERE pollid=
mysql error: You have an error in your SQL syntax near '' at line 1
mysql error number: 1064
Date: Friday 03rd of November 2000 02:08:22 PM
Script: /poll.php
Referer: http://forums.paintballcity.net/poll.php
Any ideas. :)

11-03-2000 07:05 PM

double poll: go to your postbit template,

$posticon <smallfont><B>$postitle</b></smallfont>
<p><normalfont>$message<BR><BR>$pollbit</normalfont></p>

remove $pollbit.

as for the 2nd, looking at it

11-03-2000 08:25 PM

In showthread.php my line around 180 looks like this:
Code:

$posts=$DB_site->query("SELECT post.dateline as dateline,post.postid as postid,post.pagetext as pagetext,post.allowsmilie as allowsmilie,post.signature AS showsignature,post.title as title,post.ipaddress as ipaddress,post.iconid as iconid,post.username as fakename,post.userid as userid, user.usergroupid as usergroupid,user.userid as userid,user.email as email,user.username as username,user.usertitle as usertitle,user.signature as signature,user.showemail as showemail,user.homepage as homepage,user.icq as icq,user.aim as aim,user.yahoo as yahoo,user.joindate as joindate,user.posts as posts,user.usertext as usertext,user.iconpath as iconpath,user.city as city,user.state as state,user.country as country,user.receivepm as receivepm FROM post LEFT JOIN user ON (user.userid = post.userid) WHERE post.threadid=$threadid AND visible=1 ORDER BY dateline $postorder LIMIT $limitlower,$perpage");
So I made it look like this to match:
Code:

$posts=$DB_site->query("SELECT post.pollid as pollid,post.dateline as dateline,post.postid as postid,post.pagetext as pagetext,post.allowsmilie as allowsmilie,post.signature AS showsignature,post.title as title,post.ipaddress as ipaddress,post.iconid as iconid,post.username as fakename,post.userid as userid, user.usergroupid as usergroupid,user.userid as userid,user.email as email,user.username as username,user.usertitle as usertitle,user.signature as signature,user.showemail as showemail,user.homepage as homepage,user.icq as icq,user.aim as aim,user.yahoo as yahoo,user.joindate as joindate,user.posts as posts,user.usertext as usertext,user.iconpath as iconpath,user.city as city,user.state as state,user.country as country,user.receivepm as receivepm FROM post LEFT JOIN user ON (user.userid = post.userid) WHERE post.threadid=$threadid AND visible=1 ORDER BY dateline $postorder LIMIT $limitlower,$perpage");
Could that be causing the 2nd problem above?

11-03-2000 09:14 PM

No because that error is being generated by a query in poll.php

11-03-2000 09:14 PM

ahh, you have some of the optimisation hacks installed, so yes, that should help.

perhaps you should kill your cookies and see if that helps too.

11-03-2000 09:25 PM

I would say that poll.php isn't getting the threadid passed onto it after the user logs in i.e. <SUBMIT type="hidden" name="threadid" value="$threadid">

11-03-2000 09:42 PM

Hello,

Here is the HTML in the form:
Code:

<FORM ACTION=poll.php method=post>
<INPUT TYPE=hidden name=pollid VALUE=2>
<INPUT TYPE=hidden name=pollid VALUE=2>
<INPUT TYPE=hidden name=threadid VALUE=60786>

< poll html here >

<INPUT TYPE=hidden NAME=action VALUE=pollvote>
<INPUT TYPE=hidden NAME=username VALUE=Jim Murray>
<INPUT TYPE=hidden NAME=password VALUE=xxxxxx>
<INPUT TYPE=submit NAME=submitaction VALUE=Vote!>

[Edited by VirtueTech on 11-03-2000 at 07:19 PM]

11-03-2000 09:44 PM

Jim you should delete that line with your password as I could now log on as you by passing the encrypted password on the command line.

I tried to access that thread but it must be in a forum that I don't have access to and I forget the login info for phpMyAdmin so I could tweak myself to an admin ;)

[Edited by freddie on 11-03-2000 at 06:47 PM]

11-03-2000 09:52 PM

Freddie - I made you an admin and emailed you your password to webmaster@hedgehogwheels.com


Also - Doron tried logging in and said he was able to vote on the poll. I have tried clearing my cookies...Other users have tried and gotten the same error I did.


I don't see how he could have voted and myself and my users cannot.

[Edited by VirtueTech on 11-03-2000 at 06:54 PM]

11-03-2000 09:53 PM

Well Jim I logged on as you using the trick I warned you about and this is what I see as the code for the page where it asks for your name/password

Code:

<form action="poll.php" method=post>
Username: <INPUT TYPE="TEXT" NAME="username" SIZE=7 MAXLENGTH=25>
Password: <INPUT TYPE="PASSWORD" NAME="password" SIZE=7 MAXLENGTH=13>
<input type="hidden" name="action" value="pollvote">
<input type="hidden" name="optionNumber" value="">
<input type="hidden" name="pollid" value="">
<input type="submit" value="Login!"></form>

I see fields with no values..Doron^^^I also don't see a threadid.

11-03-2000 09:57 PM

I was able to vote as myself as it didn't ask me to login.

I don't know how Doron tells if you are logged in but it should not be asking you to login when click on the vote button. Are you checking if $bbuserid != 0?

11-03-2000 10:01 PM

Hello Freddie,

GOD what trick is that? ICQ me if you don't mind...please and tell me...thanks.

Also...why does it go to the password page if I am already logged in...

If you lookk above you will see the HTML source from the showthread page where the poll resides.

11-03-2000 10:09 PM

this is wierd, why is it for you not handing over the id's with form submit, but is for me and new people.

I'd suspect it is in my coding, but there is nothing that would differenciate between users.

11-03-2000 10:14 PM

My user on his forum is not new, it has been there since day 1.

Jim edit your post where you posted the HTML and remove the line that has your password in it!

11-03-2000 10:17 PM

Jim has a space in his name whereas we don't, you could start with that and go from there.

[edit]

Yes I changed my name to "rangers fan" and now I get prompted to login so your user verification code is at fault. Why do you pass the password/username through the form instead of just checking for $bbuserid == 0 in poll.php and prompting them to login if it is 0?

btw Jim I was reading the threads in the mods forum and you can't embed viruses into .jpgs so don't fear that someone can get a virus by uploading avatars. What people believe, geez.

[Edited by freddie on 11-03-2000 at 07:23 PM]

11-03-2000 10:21 PM

freddie: came to the same conclusion, i sent him a fix, gonna see if that helps. stupid mistakeof mine

11-03-2000 10:23 PM

Ahhh I did not think of that....YES...that is it.

11-03-2000 10:32 PM

Doron - so you don't get confused by my last post....the fix did not work.

11-03-2000 10:35 PM

Freddie - I don't want the moderators to know about the control panel and other such things...but I do agree with your statement.

11-03-2000 10:35 PM

The problem is that you need to put quotes around your form variables.

ie username="$username" instead of username=$username

;)

Can I mod the "Bugs in Hacks" forum also?

11-03-2000 10:50 PM

Damn doron you made it difficult, you need to put more of it into templates. Jim you need to edit the code that sets the $formend variable in pollmodule.php and put quotes around the line that sets the $username

This line:
Code:

$formend= "<INPUT TYPE=hidden NAME=action VALUE=pollvote><INPUT TYPE=hidden NAME=username VALUE=$bbusername><INPUT TYPE=hidden NAME=password VALUE=$bbpassword><INPUT TYPE=submit NAME=submitaction VALUE=Vote!> <A HREF=poll.php?action=showresults&pollid=$pollid><normalfont>View Results</normalfont></A></FORM>";
Needs to be:

Code:

$formend= "<INPUT TYPE=\"hidden\" NAME=\"action\" VALUE=\"pollvote\"><INPUT TYPE=\"hidden\" NAME=\"username\" VALUE=\"$bbusername\"><INPUT TYPE=\"hidden\" NAME=\"password\" VALUE=\"$bbpassword\"><INPUT TYPE=\"submit\" NAME=\"submitaction\" VALUE=\"Vote!\"> <A HREF=\"poll.php?action=showresults&pollid=$pollid\"><normalfont>View Results</normalfont></A></FORM>";
(And it needs to be in a template also)

[Edited by freddie on 11-03-2000 at 07:53 PM]

11-03-2000 10:55 PM

you mean the pollmodule.php....new zip is up with the fix.

it's complex cause I do it dynamically, not via templates. It's a waste of mysql for one line only.

now this should be settled, I aplogise for the inconvinience. but that is what users are for, to be misused for finding bugs ;)

11-03-2000 11:07 PM

Doron yes but I do some dynamic things in my hacks also and you can use templates, albeit alot of them. Just look how many I use in my hacks.

11-03-2000 11:46 PM

Something's wrong...

When i click on 'view results' i get this:

There seems to have been a slight problem with the database. Please try again by pressing the refresh button in your browser.

An E-Mail has been dispatched to our Technical Staff, who you can also contact if the problem persists.

We apologise for any inconvenience.


And guess what you get on 'polltest forum'. :p
http://www.naboonline.com/polltest

Here's address line
http://www.naboonline.com/polltest/p...pollid=$pollid

There should be number instead of $pollid, right?

[Edited by PeF on 11-03-2000 at 09:02 PM]

11-04-2000 12:06 AM

Same problem here ... the "view results" link does not work.

http://209.15.159.99/showthread.php?threadid=60884

Go there and try for yourself.

11-04-2000 01:48 AM

The $pollid is being escaped somehow so it isn't being parsed. I will let Doron tell you how to fix it when he comes online..

11-04-2000 01:53 AM

This hack is very unoptimized....the person who told me this will remain anonymous.

11-04-2000 02:23 AM

Wasn't I as I have never actually looked at it other than to help fix todays problem..

11-04-2000 05:15 AM

Hmm, after looking through the code, the killer lies here:
Code:

  $pollidcheck=$DB_site->query_first("SELECT pollid FROM post WHERE threadid=$threadid");
That SQL query is issued for each table row displayed in forumdisplay, so if you have 50 threads listed per page, thats 50 extra queries.

11-04-2000 05:28 AM

ouch...maybe I should take this off for now.

11-04-2000 07:27 AM

Quote:

Originally posted by VirtueTech
This hack is very unoptimized....the person who told me this will remain anonymous.
I would love to see their version of it.

It's easy to sit back and complain about the work of others, not so easy to do it yourself. Your source would do well to remember that doron is doing this out of the goodness off his heart and doesn't have to contribute anything at all.

11-04-2000 08:51 AM

Quote:

Originally posted by Stallion
Hmm, after looking through the code, the killer lies here:
Code:

  $pollidcheck=$DB_site->query_first("SELECT pollid FROM post WHERE threadid=$threadid");
That SQL query is issued for each table row displayed in forumdisplay, so if you have 50 threads listed per page, thats 50 extra queries.

Sorry for this confusion, I was working fast to fix that spce in name thing that I messed some stuff up. argghhh

that is need however, as forumdisplay checks threads, not posts. And users wanted to have the poll icon showed without it being choosen. I could add a table to thread which would help. You can remove that code, but the custom icon won't show then.

http://www.naboonline.com/pollhack/pollmodule.php has the fix for the nonescaped showresults, it regressed cause of trying to fix the space thing at 1 AM here, and I was not thinking correctly.

I'll fix the pollidcheck thing today and add a column to the thread table.

Sorry again for this, I shoudl have tested this more, but I had 30 people email me last week requesting this hack.

11-04-2000 12:23 PM

ok, I now have the optimised version done, thanks to Ed for finding that. i had removed such code away from all other files before, somehow forgot to do that for forumdisplay.php

http://www.naboonline.com/pollhack/pollupgrade.zip is for those who are stuck with the unoptomised version.
http://www.naboonline.com/pollhack/pollv101.zip has the full version

If anyone else finds anything wrong, don't hesitate to tell.

thanks to you all for testing this and all, I guess I should be spanked for this (anyone have a paddle)?

11-04-2000 12:41 PM

Works just fine. Thanks to all. :p

11-04-2000 06:27 PM

Hello Martin,

The comment made about the hack was simply to notify everyone about the truth of the hack....the person who I will still keep anonymous is very understanding that the hack was out of the goodness of dorons heart....we were just making him aware....and thanks goes to doron for his fix. :)

11-04-2000 08:33 PM

I keep getting this error emailed to my administrators email address:
Quote:

Database error in vBulletin: Invalid SQL: SELECT threadid FROM post WHERE pollid=
mysql error: You have an error in your SQL syntax near '' at line 1
mysql error number: 1064
Date: Saturday 04th of November 2000 03:27:00 PM
Script: /poll.php
Referer: http://209.15.159.99/poll.php
Any ideas?


All times are GMT. The time now is 03:24 PM.

Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.

X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.01362 seconds
  • Memory Usage 1,827KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (8)bbcode_code_printable
  • (4)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (2)pagenav_pagelink
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (40)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • printthread_start
  • pagenav_page
  • pagenav_complete
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete