» Log in
User Name:

Password:

Not a member yet?
Register Now!
» Online Users: 93
1 members and 92 guests
Reforikolla
Most users ever online was 611, 03-21-2008 at 10:10 PM.
» .::.
Web Hosting - web hosting, dedicated servers and web design services
Online Degree - search for 1000+ online degrees, online colleges & online universities.
Tattoo - we are a group of tattoo enthusiasts
Gexa Energy - your absolute best choice in electric service
Texas electricity - save on electric rates
Football Betting - best nfl betting promotions at sportsbook.com.
Oral Chelation - initial cleansing of your veins & arteries

Register Now! Contact Us

About this Page
This is a discussion on block-Survey .php - Random Survey Tweak (for nuke 6.5) within the Nuke 6.5 to 6.9 - Blocks forums, part of the PHP-Nuke 6.5 to 6.9 category; I am looking for a block-Survey.php Tweak to return random survey instead of latest for Php Nuke 6....



Go Back   Nukemods Forum » PHP-Nuke 6.5 to 6.9 » Nuke 6.5 to 6.9 - Blocks

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 05-17-2003, 10:44 PM
Junior Member
 
Join Date: May 2003
Posts: 6
block-Survey .php - Random Survey Tweak (for nuke 6.5)
I am looking for a block-Survey.php Tweak to return random survey instead of latest for Php Nuke 6.5. Just like this one

Quote:
*** This is for Nuke 6.0 ***

Open
~Nukehome/blocks/block-Survey.php

Find this code
$result = sql_query("SELECT pollID FROM ".$prefix."_poll_desc $querylang ORDER BY pollID DESC LIMIT 1", $dbi);

And change it to
$result = sql_query("SELECT pollID FROM ".$prefix."_poll_desc $querylang ORDER BY pollID DESC LIMIT $artrand,1", $dbi);

And Above that line insert.


mt_srand((double)microtime()*1000000);
$total = sql_num_rows(sql_query("select * from ".$prefix."_poll_desc", $dbi), $dbi);
if ($total==0)
$artrand=0;
else
$artrand = mt_rand(0,($total-1));
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 05-17-2003, 11:43 PM
Moderator
 
Join Date: Jan 2003
Posts: 338
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 (eregi("block-Survey.php", $_SERVER['PHP_SELF'])) {
    Header("Location: index.php");
    die();
}

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

if ($multilingual == 1) {
    $querylang = "WHERE planguage='$currentlang' AND artid='0'";
} else {
    $querylang = "WHERE artid='0'";
}
mt_srand((double)microtime()*1000000);
$total = $db->sql_numrows($db->sql_query("select * from ".$prefix."_poll_desc"));
if ($total==0)
$artrand=0;
else
$artrand = mt_rand(0,($total-1));
$sql = "SELECT pollID FROM ".$prefix."_poll_desc $querylang ORDER BY pollID DESC LIMIT $artrand,1";
$result = $db->sql_query($sql);
$row = $db->sql_fetchrow($result);
$pollID = $row[pollID];
if ($pollID == 0 || $pollID == "") {
    $content = "";
} else {
    if(!isset($url))
        $url = sprintf("modules.php?name=Surveys&op=results&pollID=%d", $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."\">";
    $sql2 = "SELECT pollTitle, voters FROM ".$prefix."_poll_desc WHERE pollID=$pollID";
    $result2 = $db->sql_query($sql2);
    $row2 = $db->sql_fetchrow($result2);
    $pollTitle = $row2[pollTitle];
    $voters = $row2[voters];
    $boxTitle = _SURVEY;
    $content .= "<font class=\"content\">$pollTitle</font>

\n";
    $content .= "<table border=\"0\" width=\"100%\">";
    for($i = 1; $i <= 12; $i++) {
        $sql3 = "SELECT pollID, optionText, optionCount, voteID FROM ".$prefix."_poll_data WHERE (pollID=$pollID) AND (voteID=$i)";
        $result3 = $db->sql_query($sql3);
        $row3 = $db->sql_fetchrow($result3);
        if(isset($row3)) {
            $optionText = $row3[optionText];
            if ($optionText != "") {
                $content .= "<tr><td valign=\"top\"><input type=\"radio\" name=\"voteID\" value=\"".$i."\"></td><td width=\"100%\"><font class=\"content\">$optionText</font></td></tr>\n";
            }
        }
    }
    $content .= "</table>
<center><font class=\"content\"><input type=\"submit\" value=\""._VOTE."\"></font>
";
    if (is_user($user)) {
        cookiedecode($user);
    }
    for($i = 0; $i < 12; $i++) {
        $sql4 = "SELECT optionCount FROM ".$prefix."_poll_data WHERE (pollID=$pollID) AND (voteID=$i)";
        $result4 = $db->sql_query($sql4);
        $row4 = $db->sql_fetchrow($result4);
        $optionCount = $row4[optionCount];
        $sum = (int)$sum+$optionCount;
    }
    $content .= "
<font class=\"content\"><a href=\"modules.php?name=Surveys&op=results&pollID=$pollID&mode=$cookie[4]&order=$cookie[5]&thold=$cookie[6]\">"._RESULTS."</a>
<a href=\"modules.php?name=Surveys\">"._POLLS."</a>
";

    if ($pollcomm) {
        $numcom = $db->sql_numrows($db->sql_query("SELECT * FROM ".$prefix."_pollcomments WHERE pollID='$pollID'"));
        $content .= "
"._VOTES.": $sum 
 "._PCOMMENTS." $numcom\n\n";
    } else {
        $content .= "
"._VOTES." $sum\n\n";
    }
    $content .= "</font></center></form>\n\n";
}

?>
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 05-18-2003, 03:35 PM
Junior Member
 
Join Date: May 2003
Posts: 6
Thanks
I overwrited my block with your code and it works. Thanks a lot
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Poll/Survey problem! (restriced area?) EDIT: new problem! erazor Nuke 7.x - General 3 04-12-2005 11:27 AM
Survey phpbb Block phantomk Nuke 7.x - Blocks 0 11-12-2004 01:13 PM
Survey question evilsmiley Nuke 7.x - General 1 10-31-2004 01:58 PM
Gallery random iage block for nuke 6.5 haekke1 Open topics 2 05-09-2003 05:03 PM
Survey + Graphic question Caspian Nuke 6.5 to 6.9 - Blocks 0 04-29-2003 01:35 PM


All times are GMT -5. The time now is 08:51 AM.


Design by Vjacheslav Trushkin, color scheme by ColorizeIt!.

LinkBacks Enabled by vBSEO 3.1.0

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31