Poll Plugin - Ho to make Changes

Creating and modifying plugins.
Post Reply
Liberatio
Regular
Posts: 23
Joined: Wed Jul 02, 2008 2:46 pm

Poll Plugin - Ho to make Changes

Post by Liberatio »

Hi!

Does anyone know how to make changes in a running poll?

Example: A poll has two "things" to vote, A and B. A has 2 votes, B has 5.
Now life happens and a 3rd "thing", C has to be added to the poll.

But now - the poll starts again with all 3 things, A,B andC zero votes (values). How to hold (or reentry) the old values?
How can I change the order of the "Things", from A,B,C to eg. A, C, B?

If I make changes in the main database of S9y, the whole systems freak out and does not work anymore ... :oops:
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Poll Plugin - Ho to make Changes

Post by garvinhicking »

Hi!

The s9y voting plugin is very basic, it does not support changing running polls out of the box.

The ordering of options is done from insertion order, there is no ordering criteria.

The only way to do it is to modify the database table structure. What did you change exactly. Usually it should be like this:

1. Backup all existing options so you have their vote counts (dB table serendipity_polls_options)
2. Delete all existing options
3. Re insert the options, and insert the counter values from your backup

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/
Liberatio
Regular
Posts: 23
Joined: Wed Jul 02, 2008 2:46 pm

Post by Liberatio »

:D Cool. Thankz for the answer!

Greetz aus Langenfeld!
Liberatio
Regular
Posts: 23
Joined: Wed Jul 02, 2008 2:46 pm

Poll hacked

Post by Liberatio »

Hi,

I found our poll hacked(?).
Our poll has four entries.
One of those four is raising dramatically.
It seems, that a robot/tool is polling.

I downloaded the database and changed the respective value. Once uploaded again, S9y cant be shown anymore, instead that there come a error message.

Does anyone has an idea to do this right?

Does the poll module has a lmitiation for 1 I.P. vote /day?
Can I find somewhere which I.P. has voted what?

TZhankx, folks
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Poll hacked

Post by garvinhicking »

Hi!

This can very well be. The poll plugin only has cookie protection. If the user disables cookies, he can vote as many times.

There is no IP lock, the IP is not recorded. For a simple poll plugin like this one, that was too much work. If that is really needed, I really suggest to use javascript voting widgets from web 2.0 services, or a full voting tool.
I downloaded the database and changed the respective value. Once uploaded again, S9y cant be shown anymore, instead that there come a error message.
What error message? This should only happen if you edited the values wrong. Please describe how and what you exactly changed.

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/
Liberatio
Regular
Posts: 23
Joined: Wed Jul 02, 2008 2:46 pm

Post by Liberatio »

So, here is the vote originally in Sy9:


Wer ist der nächste Bürgermeister?

Bloss keiner von denen!
1%, 7 Votes

Brücker (UBV)
4%, 74 Votes

Heidinger (SPD)
6%, 106 Votes

Wansing (CDU)
91%, 1887 Votes

Total of 2082 votes.


Here is the code in the db:

4 À ` € 1 Brücker (UBV) 72 P· ” € 1 Heidinger (SPD) 105 " € ""1 Bloss keiner von denen! 7 € 1 Wansing (CDU) 1087 ·@ € 1 Wansing (CDU) 145 J·

When I change the value "1087" to another - in this case I added "00" to it and uploade the db, Sy9 shows following:

Warning: sqlite_open() [function.sqlite-open]: file is encrypted or is not a database in /homepages/34/d28006018/htdocs/include/db/sqlite.inc.php on line 54
serendipity error: unable to connect to database - exiting.

What do I have to do to change the values in the right way, without getting error message?


1000 Thx!
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

You didn't change the values in the SQLite Datafile itself? That's like editing an .EXE file of Windows with a texteditor. It will completely garbage the database.

You need to use a tool to access the database, if you google for "SQLite gui" or "sqlite admin" you should find several tools. You can use those to fix the data properly.

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/
Liberatio
Regular
Posts: 23
Joined: Wed Jul 02, 2008 2:46 pm

Post by Liberatio »

No chance. Regardless what I do or which Freeware I try, the result is: "file is encrypted or is not a database" - or even nothing.

The file to work with is "senrendipity_1234xx.db", right?

And what would be the easiest way for my "non programmer" to edit: I´m looking for an WIN-Editor, where I can load in the downloaded database, change the db and load it up again.

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

Post by garvinhicking »

Hi!

Which tools exactly did you try to use? You must choose the SQLite file that currently works on serendipity, not the one you manually edited. Also make sure when you download that .db file (it is the right one) from your webspace, you use binary transfer, not TEXT/ASCII.

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/
Liberatio
Regular
Posts: 23
Joined: Wed Jul 02, 2008 2:46 pm

Post by Liberatio »

Hi,

I tried with

SQ-Lite3 Database Manager,
SQLite-Analyzer,
SQLite Maestro,
SQLite PHP Generator,
SQliteGUI (which even has no .exe for installation).

:?

I seems so easy but may be too hard..
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi!

I once used this tool:

http://sqliteadmin.orbmu2k.de/

successfully with a s9y SQLite database file.

HTH,
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/
Liberatio
Regular
Posts: 23
Joined: Wed Jul 02, 2008 2:46 pm

Post by Liberatio »

Hi!

Thx, I got it done. One of the reason was to download as bin file (filzilla has too many traps/parameter to be set properly) and the other was to understand that the database is a closed, in itself working mechanism :idea: - far away from editing like a document.

:D


Greets!
Post Reply