PHP Web Host - Quality Web Hosting For All PHP Applications Just Great Software
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 14924
Location: Kansas

PostPosted: Fri Nov 25, 2005 11:46 pm Reply with quote Back to top

There have been many posts concerning the Survey block not working in 7.6 (and possibly other versions). I am making this replacement block available that Chatserv provided me (Thanks again Chat!) and it solved my problems. This may well work on other versions too. Note that depending on which Patch Level you are using, you may need to replace
Code:
if ( !defined('BLOCK_FILE') ) {
    Header("Location: ../index.php");
    die();
}
with
Code:
if (stristr($_SERVER['SCRIPT_NAME'], "block-Survey.php")) {
    Header("Location: index.php");
    die();
}


Replacement Block
Code:
<?php

/************************************************************************/
/* PHP-NUKE: Web Portal System                                          */
/* ===========================                                          */
/*                                                                      */
/* Copyright (c) 2002 by Francisco Burzi                                */
/* http://phpnuke.org                                                   */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/

if ( !defined('BLOCK_FILE') ) {
    Header("Location: ../index.php");
    die();
}

global $prefix, $multilingual, $currentlang, $db, $boxTitle, $content, $pollcomm, $user, $cookie, $userinfo;

if ($multilingual == 1) {
   $querylang = "WHERE planguage='$currentlang' AND artid='0'";
} else {
   $querylang = "WHERE artid='0'";
}

list($pollID) = $db->sql_fetchrow($db->sql_query("SELECT pollID FROM ".$prefix."_poll_desc $querylang ORDER BY pollID DESC LIMIT 1"));
$pollID = intval($pollID);
if ($pollID == 0 || empty($pollID)) {
   $content = "";
} else {
   if (!isset($url)) {
           $url = "modules.php?name=Surveys&amp;op=results&amp;pollID=".$pollID."";
   }
   $content .= "<form action=\"modules.php?name=Surveys\" method=\"post\">";
   $content .= "<input type=\"hidden\" name=\"pollID\" value=\"".$pollID."\">";
   $content .= "<input type=\"hidden\" name=\"forwarder\" value=\"".$url."\">";
   list($pollTitle, $voters) = $db->sql_fetchrow($db->sql_query("SELECT pollTitle, voters FROM ".$prefix."_poll_desc WHERE pollID='$pollID'"));
   $pollTitle = check_html($pollTitle, "nohtml");
   $voters = intval($voters);
   $boxTitle = _SURVEY;
   $content .= "<span class=\"content\"><strong>$pollTitle</strong></span><br><br>\n";
   $content .= "<table border=\"0\" width=\"100%\">";
   for($i = 1; $i <= 12; $i++) {
           $sql = "SELECT pollID, optionText, optionCount, voteID FROM ".$prefix."_poll_data WHERE (pollID='$pollID') AND (voteID='$i')";
           $query = $db->sql_query($sql);
      list($pollID, $optionText, $optionCount, $voteID) = $db->sql_fetchrow($query);
      $pollID = intval($pollID);
      $voteID = intval($voteID);
      $optionCount = intval($optionCount);
                if (!empty($optionText)) {
        $content .= "<tr><td valign=\"top\"><input type=\"radio\" name=\"voteID\" value=\"".$i."\"></td><td width=\"100%\"><span class=\"content\">$optionText</span></td></tr>\n";
      }
   }
   $content .= "</table><br><center><span class=\"content\"><input type=\"submit\" value=\""._VOTE."\"></span><br>";
   if (is_user($user)) {
      cookiedecode($user);
           getusrinfo($user);
   }
   $sum = 0;
   for($i = 0; $i < 12; $i++) {
           $sql = "SELECT optionCount FROM ".$prefix."_poll_data WHERE (pollID='$pollID') AND (voteID='$i')";
           $query = $db->sql_query($sql);
      list($optionCount) = $db->sql_fetchrow($query);
      $optionCount = intval($optionCount);
      $sum = (int)$sum+$optionCount;
   }

          if (!isset($mode) OR empty($mode)) {
            if(isset($userinfo['umode'])) {
              $mode = $userinfo['umode'];
            } else {
              $mode = "thread";
            }
          }
          if (!isset($order) OR empty($order)) {
            if(isset($userinfo['uorder'])) {
              $order = $userinfo['uorder'];
            } else {
              $order = 0;
            }
          }
          if (!isset($thold) OR empty($thold)) {
            if(isset($userinfo['thold'])) {
              $thold = $userinfo['thold'];
            } else {
              $thold = 0;
            }
          }
    $r_options = "";
    $r_options .= "&amp;mode=".$mode;
    $r_options .= "&amp;order=".$order;
    $r_options .= "&amp;thold=".$thold;
   $content .= "<br><span class=\"content\"><a href=\"modules.php?name=Surveys&amp;op=results&amp;pollID=".$pollID.$r_options."\"><strong>"._RESULTS."</strong></a><br><a href=\"modules.php?name=Surveys\"><strong>"._POLLS."</strong></a><br>";
   
        if ($pollcomm) {
           $sql = "SELECT * FROM ".$prefix."_pollcomments WHERE pollID='$pollID'";
      $query = $db->sql_query($sql);
                $numcom = $db->sql_numrows($query);
      $content .= "<br>"._VOTES.": <strong>".intval($sum)."</strong> <br> "._PCOMMENTS." <strong>".intval($numcom)."</strong>\n\n";
   } else {
      $content .= "<br>"._VOTES." <strong>".intval($sum)."</strong>\n\n";
   }
   $content .= "</span></center></form>\n\n";
}

?>
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
sting
Involved
Involved


Joined: Sep 23, 2003
Posts: 459
Location: Somewhere out there...

PostPosted: Fri Jan 27, 2006 12:47 pm Reply with quote Back to top

Thanks Raven
-sting
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
Dacubz
Worker
Worker


Joined: Apr 27, 2004
Posts: 143
Location: Homer Glen, Illinois

PostPosted: Sat Jan 28, 2006 5:47 pm Reply with quote Back to top

Multiple voting still can happen on my site. Is there a way to fix it besides the poll collector fix that uses the IP? I have some members that are from the same IP address, so once one votes, the other can't when I use the poll collector IP fix.
View user's profile Send private message Visit poster's website
Raven
Site Admin/Owner


Joined: Aug 27, 2002
Posts: 14924
Location: Kansas

PostPosted: Sat Jan 28, 2006 6:40 pm Reply with quote Back to top

Just expand the fix to look at username along with IP
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger
ciph3r
Worker
Worker


Joined: Jun 01, 2005
Posts: 176

PostPosted: Wed Jul 26, 2006 2:50 pm Reply with quote Back to top

I pasted the code into the block file, and my donations block is still bleeding into the survey block.
View user's profile Send private message Visit poster's website
gregexp
The Mouse Is Extension Of Arm


Joined: Feb 21, 2006
Posts: 1465
Location: In front of a screen....HELP! lol

PostPosted: Wed Jul 26, 2006 4:43 pm Reply with quote Back to top

Bleeding, Post a link to your site please.
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
ciph3r
Worker
Worker


Joined: Jun 01, 2005
Posts: 176

PostPosted: Wed Jul 26, 2006 6:19 pm Reply with quote Back to top

Only registered users can see links on this board!
Get registered or login to the forums!
View user's profile Send private message Visit poster's website
gregexp
The Mouse Is Extension Of Arm


Joined: Feb 21, 2006
Posts: 1465
Location: In front of a screen....HELP! lol

PostPosted: Wed Jul 26, 2006 6:33 pm Reply with quote Back to top

What are the first 2 blocks active on the right?
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
ciph3r
Worker
Worker


Joined: Jun 01, 2005
Posts: 176

PostPosted: Wed Jul 26, 2006 9:40 pm Reply with quote Back to top

Well, thats my problem.......Its the survey block, but the donations block is also being displayed in it.
View user's profile Send private message Visit poster's website
gregexp
The Mouse Is Extension Of Arm


Joined: Feb 21, 2006
Posts: 1465
Location: In front of a screen....HELP! lol

PostPosted: Wed Jul 26, 2006 10:34 pm Reply with quote Back to top

is the donations block activated??

Thats what im asking, Is the first 2 blocks set to the right donations then surveys?

If not, then that means that the survey block has the code for donations built into the block, You dont want this.

If (all this is true){
paste the block code
}else{
correct me where wrong
}

Forgive me but I'm in a laughing mood and that just made me laugh.
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
ciph3r
Worker
Worker


Joined: Jun 01, 2005
Posts: 176

PostPosted: Wed Jul 26, 2006 10:38 pm Reply with quote Back to top

Code:
<?php

/************************************************************************/
/* PHP-NUKE: Web Portal System                                          */
/* ===========================                                          */
/*                                                                      */
/* Copyright (c) 2002 by Francisco Burzi                                */
/* http://phpnuke.org                                                   */
/*                                                                      */
/* This program is free software. You can redistribute it and/or modify */
/* it under the terms of the GNU General Public License as published by */
/* the Free Software Foundation; either version 2 of the License.       */
/************************************************************************/

if ( !defined('BLOCK_FILE') ) {
    Header("Location: ../index.php");
    die();
}

global $prefix, $multilingual, $currentlang, $db, $boxTitle, $content, $pollcomm, $user, $cookie, $userinfo;

if ($multilingual == 1) {
   $querylang = "WHERE planguage='$currentlang' AND artid='0'";
} else {
   $querylang = "WHERE artid='0'";
}

list($pollID) = $db->sql_fetchrow($db->sql_query("SELECT pollID FROM ".$prefix."_poll_desc $querylang ORDER BY pollID DESC LIMIT 1"));
$pollID = intval($pollID);
if ($pollID == 0 || empty($pollID)) {
   $content = "";
} else {
   if (!isset($url)) {
           $url = "modules.php?name=Surveys&amp;op=results&amp;pollID=".$pollID."";
   }
   $content .= "<form action=\"modules.php?name=Surveys\" method=\"post\">";
   $content .= "<input type=\"hidden\" name=\"pollID\" value=\"".$pollID."\">";
   $content .= "<input type=\"hidden\" name=\"forwarder\" value=\"".$url."\">";
   list($pollTitle, $voters) = $db->sql_fetchrow($db->sql_query("SELECT pollTitle, voters FROM ".$prefix."_poll_desc WHERE pollID='$pollID'"));
   $pollTitle = check_html($pollTitle, "nohtml");
   $voters = intval($voters);
   $boxTitle = _SURVEY;
   $content .= "<span class=\"content\"><strong>$pollTitle</strong></span><br><br>\n";
   $content .= "<table border=\"0\" width=\"100%\">";
   for($i = 1; $i <= 12; $i++) {
           $sql = "SELECT pollID, optionText, optionCount, voteID FROM ".$prefix."_poll_data WHERE (pollID='$pollID') AND (voteID='$i')";
           $query = $db->sql_query($sql);
      list($pollID, $optionText, $optionCount, $voteID) = $db->sql_fetchrow($query);
      $pollID = intval($pollID);
      $voteID = intval($voteID);
      $optionCount = intval($optionCount);
                if (!empty($optionText)) {
        $content .= "<tr><td valign=\"top\"><input type=\"radio\" name=\"voteID\" value=\"".$i."\"></td><td width=\"100%\"><span class=\"content\">$optionText</span></td></tr>\n";
      }
   }
   $content .= "</table><br><center><span class=\"content\"><input type=\"submit\" value=\""._VOTE."\"></span><br>";
   if (is_user($user)) {
      cookiedecode($user);
           getusrinfo($user);
   }
   $sum = 0;
   for($i = 0; $i < 12; $i++) {
           $sql = "SELECT optionCount FROM ".$prefix."_poll_data WHERE (pollID='$pollID') AND (voteID='$i')";
           $query = $db->sql_query($sql);
      list($optionCount) = $db->sql_fetchrow($query);
      $optionCount = intval($optionCount);
      $sum = (int)$sum+$optionCount;
   }

          if (!isset($mode) OR empty($mode)) {
            if(isset($userinfo['umode'])) {
              $mode = $userinfo['umode'];
            } else {
              $mode = "thread";
            }
          }
          if (!isset($order) OR empty($order)) {
            if(isset($userinfo['uorder'])) {
              $order = $userinfo['uorder'];
            } else {
              $order = 0;
            }
          }
          if (!isset($thold) OR empty($thold)) {
            if(isset($userinfo['thold'])) {
              $thold = $userinfo['thold'];
            } else {
              $thold = 0;
            }
          }
    $r_options = "";
    $r_options .= "&amp;mode=".$mode;
    $r_options .= "&amp;order=".$order;
    $r_options .= "&amp;thold=".$thold;
   $content .= "<br><span class=\"content\"><a href=\"modules.php?name=Surveys&amp;op=results&amp;pollID=".$pollID.$r_options."\"><strong>"._RESULTS."</strong></a><br><a href=\"modules.php?name=Surveys\"><strong>"._POLLS."</strong></a><br>";
   
        if ($pollcomm) {
           $sql = "SELECT * FROM ".$prefix."_pollcomments WHERE pollID='$pollID'";
      $query = $db->sql_query($sql);
                $numcom = $db->sql_numrows($query);
      $content .= "<br>"._VOTES.": <strong>".intval($sum)."</strong> <br> "._PCOMMENTS." <strong>".intval($numcom)."</strong>\n\n";
   } else {
      $content .= "<br>"._VOTES." <strong>".intval($sum)."</strong>\n\n";
   }
   $content .= "</span></center></form>\n\n";
}

?>
View user's profile Send private message Visit poster's website
gregexp
The Mouse Is Extension Of Arm


Joined: Feb 21, 2006
Posts: 1465
Location: In front of a screen....HELP! lol

PostPosted: Wed Jul 26, 2006 10:45 pm Reply with quote Back to top

ok that makes no sense.

Are you positive that you do not have something active above this block?
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
ciph3r
Worker
Worker


Joined: Jun 01, 2005
Posts: 176

PostPosted: Thu Jul 27, 2006 12:16 am Reply with quote Back to top

lol........yes.

I searched the forums, and found that apparently other people are having this problem too.

And yes, I am 100% sure. Look.
Only registered users can see links on this board!
Get registered or login to the forums!
Only registered users can see links on this board!
Get registered or login to the forums!
Only registered users can see links on this board!
Get registered or login to the forums!


3 different CMS's.
rnuke is the one having the block problem.
View user's profile Send private message Visit poster's website
gregexp
The Mouse Is Extension Of Arm


Joined: Feb 21, 2006
Posts: 1465
Location: In front of a screen....HELP! lol

PostPosted: Thu Jul 27, 2006 6:55 am Reply with quote Back to top

funny, try removing the $content variable from the globals.
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
ciph3r
Worker
Worker


Joined: Jun 01, 2005
Posts: 176

PostPosted: Fri Jul 28, 2006 2:11 pm Reply with quote Back to top

darklord wrote:
funny, try removing the $content variable from the globals.


WTF is funny?

I removed the variable, and it got rid of the problem.....but seriously.

Are you here to help, or be a smart elic? Why is that variable in this post, which is supposed to be the fix.....if the variable is not supposed to be there?

As you can see, its apparently a common problem.

Only registered users can see links on this board!
Get registered or login to the forums!
View user's profile Send private message Visit poster's website
Guardian2003
Site Admin


Joined: Aug 28, 2003
Posts: 4553
Location: Poland

PostPosted: Fri Jul 28, 2006 2:43 pm Reply with quote Back to top

I think darklord meant funny (thats peculiar) not funny (hahaha), perhaps you should keep that in mind when using forums with multiple nationalities, language and try not to read a 'tone'.
I have done it myself many times.
View user's profile Send private message Send e-mail Visit poster's website
ciph3r
Worker
Worker


Joined: Jun 01, 2005
Posts: 176

PostPosted: Fri Jul 28, 2006 3:28 pm Reply with quote Back to top

Ahh, understood, my apologies.

Thx for your response.

Also, has anyone else noticed the bug when you run IPN Reconsile?
The script seems to run right, but the table is cutoff at the bottom once you run it.
View user's profile Send private message Visit poster's website
gregexp
The Mouse Is Extension Of Arm


Joined: Feb 21, 2006
Posts: 1465
Location: In front of a screen....HELP! lol

PostPosted: Fri Jul 28, 2006 6:13 pm Reply with quote Back to top

Just to respond, I did mean peculiar and I asked you to remove that from the globals because I believed it was calling content from another block and causing your error, It was a shot in the dark and I had not seen it before myself.

My apologies if I was misunderstood but I had no intension of giving you the idea I was laughing, It actually had me baffled for a minute but now that you have verified my thinking, Thank you.

To answer your question, $content is a variable blocks use to varify there is something within the block, It is in almost ALL blocks and therefore globalizing it may cause it to "merge" 2 blocks. I stated that with a theory, I was not positive of the outcome of my sudjested fix.

Thank you for verifying that and now, Glad to see you are up and running correctly.
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
ciph3r
Worker
Worker


Joined: Jun 01, 2005
Posts: 176

PostPosted: Fri Jul 28, 2006 6:36 pm Reply with quote Back to top

ahh, nicely put.
Thx dude.
View user's profile Send private message Visit poster's website
montego
Site Admin


Joined: Aug 29, 2004
Posts: 7236
Location: Arizona

PostPosted: Sat Jul 29, 2006 8:52 am Reply with quote Back to top

Just to expound upon the "knowledge base" here, I want to mention that every block needs to initialize the $content variable right up front! Either the first "assignment" needs to be of the form:

$content = "whatever first sting is being set";

(i.e., NOT $content .= ) <- see the "."?

or, it needs to be:

$content = '';

or

$content = "";

That is the only proper way of starting off each block "on the right track" so to speak and to ensure that NO prior string in the $content variable carries forward into another block.
View user's profile Send private message Visit poster's website
ciph3r
Worker
Worker


Joined: Jun 01, 2005
Posts: 176

PostPosted: Sat Jul 29, 2006 12:00 pm Reply with quote Back to top

but $content SHOULD NOT be in the globals right?
View user's profile Send private message Visit poster's website
montego
Site Admin


Joined: Aug 29, 2004
Posts: 7236
Location: Arizona

PostPosted: Sat Jul 29, 2006 12:28 pm Reply with quote Back to top

Does not matter if it is used properly as I have mentioned in the previous post.
View user's profile Send private message Visit poster's website
gregexp
The Mouse Is Extension Of Arm


Joined: Feb 21, 2006
Posts: 1465
Location: In front of a screen....HELP! lol

PostPosted: Sat Jul 29, 2006 9:06 pm Reply with quote Back to top

Ahh true. $content will be redeclared if used properly like montego stated.

if ($pollID == 0 || empty($pollID)) {
$content = "";

Id almost bet that is the root of the problem.
View user's profile Send private message Send e-mail Visit poster's website AIM Address