Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> phpnuke 7.6
Author Message
Raven
Site Admin/Owner



Joined: Aug 27, 2002
Posts: 17088

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

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=\"surveys.html\" 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=\"surveys.html\"><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
sting
Involved
Involved



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

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

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: 156
Location: Homer Glen, Illinois

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

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







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

Just expand the fix to look at username along with IP
 
ciph3r
Worker
Worker



Joined: Jun 01, 2005
Posts: 178

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

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: 1497
Location: In front of a screen....HELP! lol

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

Bleeding, Post a link to your site please.

_________________
For those who stand shall NEVER fall and those who fall shall RISE once more!! 
View user's profile Send private message Send e-mail Visit poster's website AIM Address Yahoo Messenger MSN Messenger ICQ Number
ciph3r







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

www.clangoat.com/rnuke
 
gregexp







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

What are the first 2 blocks active on the right?
 
ciph3r







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

Well, thats my problem.......Its the survey block, but the donations block is also being displayed in it.
 
gregexp







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

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.
 
ciph3r







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

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=\"surveys.html\" 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=\"surveys.html\"><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";
}

?>
 
gregexp







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

ok that makes no sense.

Are you positive that you do not have something active above this block?
 
ciph3r







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

lol........yes.

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

And yes, I am 100% sure. Look.

http://www.clangoat.com
http://www.clangoat.com/rnuke
http://www.clangoat.com/pnc

3 different CMS's.
rnuke is the one having the block problem.
 
gregexp







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

funny, try removing the $content variable from the globals.
 
ciph3r







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

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!
 
Guardian2003
Site Admin



Joined: Aug 28, 2003
Posts: 6799
Location: Ha Noi, Viet Nam

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

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
ciph3r







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

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.
 
gregexp







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

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.
 
ciph3r







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

ahh, nicely put.
Thx dude.
 
montego
Site Admin



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

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

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.

_________________
Only registered users can see links on this board! Get registered or login!
Only registered users can see links on this board! Get registered or login! 
View user's profile Send private message Visit poster's website
ciph3r







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

but $content SHOULD NOT be in the globals right?
 
montego







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

Does not matter if it is used properly as I have mentioned in the previous post.
 
gregexp







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

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.
 
Display posts from previous:       
This forum is locked: you cannot post, reply to, or edit topics.   This topic is locked: you cannot edit posts or make replies.    Ravens PHP Scripts And Web Hosting Forum Index -> phpnuke 7.6

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©