Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

[Contribution] Pollbooth v2.0


Ian

Recommended Posts

As i've been saying i thought that a check for customer_id when the "Allow Multiple Votes" option is set to 0 (zero). I've been working a lot on oscommerce and its queries lately so i thought i'd give it a shot.

 

First use this SQL command on the database but first BACKUP BACKUP BACKUP!!!!!!! But i'm sure you already knew that :P

ALTER TABLE `phesis_poll_check` ADD `customer_id` int(11) UNSIGNED DEFAULT "0" NOT NULL;

Then open poll_collect.php

Search for the following block of code:

 

  if ($votevalid==1 && POLL_SPAM==0) {
               $result=tep_db_query("SELECT ip FROM phesis_poll_check WHERE ip='".$ip."' and pollid='".$pollid."'");
               $result1=tep_db_fetch_array($result);
               $ips=$result1['ip'];
               $ctime = time();
               if ($ip == $ips) {
                       $votevalid = 0;
                     $info_message1 = "YOU ALREADY VOTED ";
                           } else {
                     tep_db_query("INSERT INTO phesis_poll_check (ip, time, pollID) VALUES ('".$ip."', '".$ctime."' , '".$pollid."')");
                       $votevalid = 1;

 

Replace with this one (the previous code gets commented and the new code is added, so don't be afraid.

 

/*  If you want to check by IP uncomment this block  
 if ($votevalid==1 && POLL_SPAM==0) {
               $result=tep_db_query("SELECT ip FROM phesis_poll_check WHERE ip='".$ip."' and pollid='".$pollid."'");
               $result1=tep_db_fetch_array($result);
               $ips=$result1['ip'];
               $ctime = time();
               if ($ip == $ips) {
                       $votevalid = 0;
                     $info_message1 = "YOU ALREADY VOTED ";
                           } else {
                     tep_db_query("INSERT INTO phesis_poll_check (ip, time, pollID) VALUES ('".$ip."', '".$ctime."' , '".$pollid."')");
                       $votevalid = 1;*/
     
/*This block checks by customer id (1 vote per customer id)*/      
       if ($votevalid==1 && POLL_SPAM==0) {
               $result=tep_db_query("SELECT customer_id FROM phesis_poll_check WHERE customer_id='".$customer_id."' and pollid='".$pollid."'");
               $result1=tep_db_fetch_array($result);
               $customers=$result1['customer_id'];
               $ctime = time();
               if ($customer_id == $customers) {
                       $votevalid = 0;
                     $info_message1 = "YOU ALREADY VOTED ";
                           } else {
                     tep_db_query("INSERT INTO phesis_poll_check (ip, time, pollID, customer_id) VALUES ('".$ip."', '".$ctime."' , '".$pollid."', '".$customer_id."')");
                       $votevalid = 1;      

 

Ok, any comments, suggestions or corrections, please do so :D I'm very new to oscommerce, php and mysql. This worked great for me.

Link to comment
Share on other sites

  • 1 month later...
  • Replies 356
  • Created
  • Last Reply

Top Posters In This Topic

Hi! I've installed this contrib a while ago and usually it works ok. But it happens sometimes, when you first tr to vote to get this error:

 

Fatal error: Cannot redeclare tep_db_connect() (previously declared in /home/muccelmi/public_html/muccelmic/includes/functions/database.php:13) in /home/muccelmi/public_html/muccelmic/includes/functions/database.php on line 13

 

Although this doesn't always appear, it may discourage clients to vote (they don't know they should try again). So, I need an advice on what to do. Thanks!

 

I have the same problem!

I have downloaded the latest contribution but it still remains.

The vote is casted tho.

Any tips would be helpfull.

Thanks

 

Spyros

Edited by Johnson

Spyros

Link to comment
Share on other sites

  • 2 weeks later...

Can anyone tell me why in poll_results.php, around line 99, there is this code:

 

<?php echo htmlspecialchars($comments['comment']); ?>

 

This code generates \' wherever the comment contains a '.

 

I changed this line to:

 

<?php echo stripslashes($comments['comment']); ?>

 

and now the comments are shown properly. Can anyone tell me what difference this makes, and if there are any bad effects of that change?

Thanks for any help/comments.

 

Regards,

 

Lewis Hill

Link to comment
Share on other sites

I can't :)

 

I installed your new contribution, but after everything is done, i get this error message when entering the admin panel:

 

Fatal error: Cannot redeclare class pollinfo in [...full-path...]/catalog/admin/includes/classes/poll_info.php on line 3

 

And have no clue what it is... Can you help?

Link to comment
Share on other sites

I can't :)

 

I installed your new contribution, but after everything is done, i get this error message when entering the admin panel:

 

Fatal error: Cannot redeclare class pollinfo in [...full-path...]/catalog/admin/includes/classes/poll_info.php on line 3

 

And have no clue what it is... Can you help?

 

First thing is make sure there are no blank lines at the bottom of the file.

 

If that doesn't help post again

Thanks for any help/comments.

 

Regards,

 

Lewis Hill

Link to comment
Share on other sites

ahh, got it fixed .. somehow I got into aplication_top.php twice the include of the file ... so that was the error ...

 

It's a bit confusng in this new package:

- you have instal.txt, where it says what you need to do, and you have in folder catalog/ files to copy into shop. But in folders there are also some txt files, which have some lines to be added to the end of specific files and those addons are also included in install.txt. That is not good. I hope you understand what I mean :).

 

And also there are differences -

 

install.txt has this:

---------------------------------------------------------------------------
application_top.php in /admin/includes 
add 


// entry/item info classes   
require(DIR_WS_CLASSES . 'poll_info.php');
require(DIR_WS_CLASSES . 'configuration_info.php'); 

 ---------------------------------------------------------------------------

 

And the filename: aplication_top.php.txt has this:

define('FILENAME_POLLS', 'polls.php');

// entry/item info classes

 require(DIR_WS_CLASSES . 'poll_info.php');

 

Either you write everything it has to be copied/pasted to the end of specific files into install.txt and remove all that from catalog/../ txt files. or the other way arround, so it won't be confusing. Because I did at first copy everything into shop, then corrected everything according to .txt files in folders and then went through install.txt and then had to chec for stuff, that's been allready done or has been don incomplete as in above example. Just a friendly advice :).

 

Thank you a lot for the contribution and have a nice day!

 

BR, Poldi

Link to comment
Share on other sites

  • 2 weeks later...

hello i just installed the version 2.2 25/08/2005 but it has some problems

 

1.to the admin area (control panel) when i clic to the preview button i get this message Warning: main(includes/form_check.js.php): failed to open stream: No such file or directory in c:\easyphp1-8\www\catalog\admin\pollbooth.php on line 15

 

Fatal error: main(): Failed opening required 'includes/form_check.js.php' (include_path='.;C:\EASYPH~1\\php\pear\') in c:\easyphp1-8\www\catalog\admin\pollbooth.php on line 15

if i remove the code <?php require('includes/form_check.js.php'); ?>

from the page it works

 

2.in control panel every time i am tryin to delete a comment then a popup window opens and ask me to give a code and a username for connecting me to clickce admin at www.clickce.com

Do you have any idea?

Link to comment
Share on other sites

  • 4 weeks later...
hello i just installed the version 2.2 25/08/2005 but it has some problems

 

2.in control panel every time i am tryin to delete a comment then a popup window opens and ask me to give a code and a username for connecting me to clickce admin at www.clickce.com

Do you have any idea?

 

In file catalog/admin/poll_delete.php you must change :

Around line 16 find: header("location: http://www.clickce.com/buy/admin/polls.php...t");"

Change http address to your desired.

That's it.

Sorry about my english. :)

Edited by Bamas
Link to comment
Share on other sites

Hi friends!

I get this error when I?m trying to install this contrib:

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-20, 20' at line 1

select pollID, voters, timeStamp, poll_type, poll_open from phesis_poll_desc order by pollID asc limit -20, 20

[TEP STOP]

 

Anyone know how to fix this?

 

Thx!!

Link to comment
Share on other sites

i have problem with position in my OsCommerce

 

column right

 

$sts_block_name = 'columnleft2columnright';

require(STS_RESTART_CAPTURE);

// STS: EOADD

require(DIR_WS_BOXES . 'reviews.php');

// STS: ADD

$sts_block_name = 'reviewsbox';

require(STS_RESTART_CAPTURE);

//START POLLBOOTH

require (DIR_WS_BOXES . 'polls.php');

//END POLLBOOTH

require(STS_RESTART_CAPTURE);

 

rwview box is not listen on the site any help ???

Edited by ddSHADOW
Link to comment
Share on other sites

In the poll configuration in the admin, you can set polls to be displayed random, when I put it on random he shows the latest one instead of random and how can I get all the polls to be active... I have in each category of my shop a poll but I can only display 1, even if it is in different categories!!!

Link to comment
Share on other sites

Hi friends!

I get this error when I?m trying to install this contrib:

1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '-20, 20' at line 1

select pollID, voters, timeStamp, poll_type, poll_open from phesis_poll_desc order by pollID asc limit -20, 20

[TEP STOP]

 

Anyone know how to fix this?

 

Thx!!

 

Try to find solution here: http://www.oscommerce.com/community/bugs,1...2B%28General%29

Link to comment
Share on other sites

Can any one tell me if they are able to add a comment from the admin ?

 

I get the folowing error after submiting the comment.

The requested URL /admin/http://www.dvbhardware.com/admin/pollbooth.php was not found on this server.

 

Any thoughts ?

 

Jimmy

Edited by RI Downlink

I'm not a coder just a splicer.

Link to comment
Share on other sites

In the poll configuration in the admin, you can set polls to be displayed random, when I put it on random he shows the latest one instead of random and how can I get all the polls to be active... I have in each category of my shop a poll but I can only display 1, even if it is in different categories!!!

 

Can someone just help me out, I checked a couple of sites with this contrib and it works correct on that site, I installed this contrib using the install text and I can't get it working on multiple pages at the same time where others can!!!! please help!!!!

Edited by derk.d
Link to comment
Share on other sites

  • 2 weeks later...

I fixed the problem above and beneath

 

Hi all,

I'm working on a site with many contributions and all is fine, except the Pollbooth.......Every category has a poll but only the latest I made is shown. When I go to another category than Kerstmis there is no poll shown......

In admin there no errors and on catalog side also none..... Conclusion (?): it has to be something with the pollcollect.php???

laterssssssss,

Chris

 

P.S. The failure was mentioned a couple of times in the thread but still no solution?

 

I just found out what to change

open polls.php in catalog/includes/boxes/

go to line 33.

you see this query

$query= tep_db_query("select pollid, catID FROM phesis_poll_desc where poll_open='0'".$extra_query." and catID = 0 order by ".$order);

 

replace it with this:

$query= tep_db_query("select pollid, catID FROM phesis_poll_desc where poll_open='0'".$extra_query." and catID = ".$HTTP_GET_VARS['cPath'] ." order by ".$order);

 

now it wil work!!!

Edited by derk.d
Link to comment
Share on other sites

I fixed the problem above and beneath

 

 

 

I just found out what to change

open polls.php in catalog/includes/boxes/

go to line 33.

you see this query

$query= tep_db_query("select pollid, catID FROM phesis_poll_desc where poll_open='0'".$extra_query." and catID = 0 order by ".$order);

 

replace it with this:

$query= tep_db_query("select pollid, catID FROM phesis_poll_desc where poll_open='0'".$extra_query." and catID = ".$HTTP_GET_VARS['cPath'] ." order by ".$order);

 

now it wil work!!!

 

there was still an error in the mainpage

 

replace this:

$query= tep_db_query("select pollid, catID FROM phesis_poll_desc where poll_open='0'".$extra_query." and catID = 0 order by ".$order);

 

with this:

if(empty($HTTP_GET_VARS['cPath'])){

$catid=0;

}else{

$catid = $HTTP_GET_VARS['cPath'] ;

}

$query= tep_db_query("select pollid, catID FROM phesis_poll_desc where poll_open='0'".$extra_query." and catID = ".$catid ." order by ".$order);

Link to comment
Share on other sites

there was still an error in the mainpage

 

replace this:

$query= tep_db_query("select pollid, catID FROM phesis_poll_desc where poll_open='0'".$extra_query." and catID = 0 order by ".$order);

 

with this:

if(empty($HTTP_GET_VARS['cPath'])){

$catid=0;

}else{

$catid = $HTTP_GET_VARS['cPath'] ;

}

$query= tep_db_query("select pollid, catID FROM phesis_poll_desc where poll_open='0'".$extra_query." and catID = ".$catid ." order by ".$order);

 

I posted 2 bufixes, but when I repaired one, another one came back:(

the new bugfix contains a fix for the subcatergories! If you have subcategories you will get an error! this is fixed now!

replace this:

 

$query= tep_db_query("select pollid, catID FROM phesis_poll_desc where poll_open='0'".$extra_query." and catID = 0 order by ".$order);

 

for this one:

 

if(empty($HTTP_GET_VARS['cPath'])){

$catid=0;

}

if($HTTP_GET_VARS['cPath']) {

$mypath = $HTTP_GET_VARS['cPath'];

list($catid, $subcatid)=split("[_]", $mypath);

//echo $catid;

}

 

$query= tep_db_query("select pollid, catID FROM phesis_poll_desc where poll_open='0'".$extra_query." and catID = ".$catid ." order by ".$order);

 

hopefully this contrib is now bugfree

Link to comment
Share on other sites

  • 2 weeks later...

Hello

 

I get this error in my shop:

 

/home/telecom/public_html/templates/8755/main_page.tpl.php on line 105

 

Fatal error: main(): Failed opening required 'templates/content/<tr><td colspan="2" class="main">Que te parece nuestra Web?</td></tr><input type="hidden" name="pollid" value="1"> <input type="hidden" name="forwarder" value="http://www.telecomlibre.net/pollbooth.php?op=results&pollid=1"> <tr class="pollOptRow"><td class="pollBoxRow"><input type="radio" name="voteid" value="1" class="radio"></td><td class="pollBoxRow">Muy buena</td></tr><tr class="pollOptRow"><td class="pollBoxRow"><input type="radio" name="voteid" value="2" class="radio"></td><td class="pollBoxRow">Normal</td></tr><tr class="pollOptRow"><td class="pollBoxRow"><input type="rad in /home/telecom/public_html/templates/8755/main_page.tpl.php on line 105

 

 

Does anybody knows what happen?

Link to comment
Share on other sites

  • 2 weeks later...

Hi all,

 

Great contrib, very useful for gathering some info from visitors.

 

NOW>.. If we can only get a bad/vulger list (input box in admin) to substitute some of the comments left by visitors that would be the very coolest@!

 

Taken from phpbb...

Word Censoring

From this control panel you can add, edit, and remove words that will be automatically censored on your forums. In addition people will not be allowed to register with usernames containing these words. Wildcards (*) are accepted in the word field. For example, *test* will match detestable, test* would match testing, *test would match detest.

 

 

Thanks much for any input!

KJ

Edited by Top_Speed

define('PROJECTS', 'Something that goes on forever!');

Link to comment
Share on other sites

  • 2 weeks later...

For some reason when I try to add a comment from the admin side, it gives me this error:

 

 

Not Found

The requested URL /admin/http://xxxxxxxxxxxxx/admin/pollbooth.php was not found on this server.

 

Apache/1.3.34 Server at xxxxxxxxxxxxxxxx Port 80

 

So I guess somewhere its trying to access the directory before the domain?

Help please

Link to comment
Share on other sites

  • 2 weeks later...
  • 4 weeks later...

Hy!

 

I did exacly as it is written in install.txt, but it is not working.

 

Warning: main(DIR_WS_CLASSESpoll_info.php): failed to open stream: No such file or directory in c:\appserv\www\admin\includes\application_top.php on line 15

 

Fatal error: main(): Failed opening required 'DIR_WS_CLASSESpoll_info.php' (include_path='.;c:\php4\pear') in c:\appserv\www\admin\includes\application_top.php on line 15

 

This is on my screen when I want to go in /admin/index.php

 

 

Any ideas?

 

 

drumer

Link to comment
Share on other sites

Hy!

 

I did exacly as it is written in install.txt, but it is not working.

 

Warning: main(DIR_WS_CLASSESpoll_info.php): failed to open stream: No such file or directory in c:\appserv\www\admin\includes\application_top.php on line 15

 

Fatal error: main(): Failed opening required 'DIR_WS_CLASSESpoll_info.php' (include_path='.;c:\php4\pear') in c:\appserv\www\admin\includes\application_top.php on line 15

 

This is on my screen when I want to go in /admin/index.php

Any ideas?

drumer

 

for some reason your script isn't seeing your includes/configure.php

make sure you have the files in the right position first I see this alot people mix the files up

if that isn't the problem the you would have to add some script to make it see the config

 

ie: include('includes/configure.php');

 

you can use that for testing

 

if that is in then your configuration file is not correct.

and you will have to fix that

Edited by IceTheNet
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...