Fatal Error....PLEASE HELP....NSN UNIVERSAL CENTER BLOCKS

  Post new topicReply to topicPrintable Version
<< View previous topic View next topic >>
Share: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
#1   Fatal Error....PLEASE HELP....NSN UNIVERSAL CENTER BLOCKS
Dobie1
CZ Newbie
Dobie1 has been a member for over 19 year's 19 Year Member
Gender: Male
Status: Offline
Joined: Jan 05, 2005
0.00 posts per day
Posts: 2
Points: 546
   
I just installed the NSN Center blocks and I get the following error
Fatal error: Cannot redeclare cb_blocks() (previously declared in /home/site/public_html/includes/nsncb_func.php:10) in /home/site/public_html/includes/nsncb_func.php on line 10

I saw another post in another forum and someone asked about the SQL DB...the reply to that question was ..."upload and run nsncb.php and that will install the necessary tables..." That file was included and I uploaded it. How do I run it. This is where the instructions say to upload this nsncb.php file.
Here is the nsncb.php file

<?php

/********************************************************/
/* NSN Center Blocks(TM) Universal                      */
/* By: NukeScripts Network (webmaster@nukescripts.net)  */
/* http://www.nukescripts.net                           */
/* Copyright © 2000-2005 by NukeScripts Network         */
/********************************************************/

require_once("mainfile.php");
global $admin;
if(!is_array($admin) AND is_admin($admin)) {
    $adm = base64_decode($admin);
    $adm = explode(":", $adm);
    $aname = "$adm[0]";
} elseif(is_array($admin) AND is_admin($admin)) {
    $aname = "$admin[0]";
}
$index=1;

$adm_info = $db->sql_fetchrow($db->sql_query("SELECT * FROM ".$prefix."_authors WHERE aid='$aname'"));
if ($adm_info['radminsuper']==1) {

switch($op) {

    default:
        $pagetitle = "NSN Center Blocks";
        include("header.php");
        title("$pagetitle");
        OpenTable();
        echo "<table align='center' border='0' cellpadding='2' cellspacing='2'>\n";
        echo "<form action='".$_SERVER['PHP_SELF']."' method='post'>\n";
        echo "<tr><td>This script will install, destall or upgrade the tables for the $pagetitle.</td></tr>\n";
        echo "<tr><td><b>Backup data tables before going on!</b></td></tr>\n";
        echo "<tr><td><select name='op'>\n";
        echo "<option value=''>---- Install Options ----</option>\n";
        echo "<option value='install'>First Time Install of $pagetitle</option>\n";
        echo "<option value=''>---- Upgrade Options ----</option>\n";
        echo "<option value='1xx-200'>Upgrade $pagetitle 1.x.x to 2.0.0</option>\n";
        echo "<option value='200-201'>Upgrade $pagetitle 2.0.0 to 2.0.1</option>\n";
        echo "<option value='201-210'>Upgrade $pagetitle 2.0.1 to 2.1.0</option>\n";
        echo "<option value=''>---- Destall Options ----</option>\n";
        echo "<option value='destall'>Destall $pagetitle</option>\n";
        echo "</select> <input type='submit' value='COMMIT'></td></tr>\n";
        echo "<tr><td><b>Once you have finished with this script, delete it from your server!</b></td></tr>\n";
        echo "</form>";
        echo "</table><br />\n";
        echo "<table border='0' cellpadding='0' cellspacing='0' align='center'>\n";
        echo "<tr><td width='100%' align='center'><b>Help Support NukeScripts™</b></td></tr>\n";
        echo "<tr><td width='100%' align='center'><a href='http://www.nukescripts.net/modules.php?name=Donations'><img src='https://www.paypal.com/en_US/i/btn/x-click-but21.gif' border='0' alt='Make donations with PayPal!'  align='center'></a></td></tr>\n";
        echo "</table>\n";
        CloseTable();
        include("footer.php");
    break;

    case "install":
        $pagetitle = "NSN Center Blocks: Install";
        include("header.php");
        title("$pagetitle");
        OpenTable();
        echo "Operation Status!<br>\n";
        echo "<hr>\n";
        $result = $db->sql_query("CREATE TABLE ".$prefix."_nsncb_blocks (rid tinyint(2) NOT NULL default '0', cgid tinyint(2) NOT NULL default '0', cbid tinyint(2) NOT NULL default '0', title varchar(60) NOT NULL default '', filename varchar(255) NOT NULL default '', content text NOT NULL, wtype tinyint(1) NOT NULL default '0', width smallint(6) NOT NULL default '0', PRIMARY KEY  (rid), UNIQUE KEY rid (rid))");
        if (!$result) { echo "- Create ".$prefix."_nsncb_blocks failed<br>\n"; } else { echo "- Create ".$prefix."_nsncb_blocks succeded<br>\n"; }
        $result = $db->sql_query("INSERT INTO ".$prefix."_nsncb_blocks VALUES (1, 1, 1, 'Place Holder', '', 'This is only a place holder', 1, 25)");
        if (!$result) { echo "- Insert into ".$prefix."_nsncb_blocks failed<br>\n"; } else { echo "- Insert into ".$prefix."_nsncb_blocks succeded<br>\n"; }
        $result = $db->sql_query("INSERT INTO ".$prefix."_nsncb_blocks VALUES (2, 1, 2, 'Place Holder', '', 'This is only a place holder', 1, 25)");
        if (!$result) { echo "- Insert into ".$prefix."_nsncb_blocks failed<br>\n"; } else { echo "- Insert into ".$prefix."_nsncb_blocks succeded<br>\n"; }
        $result = $db->sql_query("INSERT INTO ".$prefix."_nsncb_blocks VALUES (3, 1, 3, 'Place Holder', '', 'This is only a place holder', 1, 25)");
        if (!$result) { echo "- Insert into ".$prefix."_nsncb_blocks failed<br>\n"; } else { echo "- Insert into ".$prefix."_nsncb_blocks succeded<br>\n"; }
        $result = $db->sql_query("INSERT INTO ".$prefix."_nsncb_blocks VALUES (4, 1, 4, 'Place Holder', '', 'This is only a place holder', 1, 25)");
        if (!$result) { echo "- Insert into ".$prefix."_nsncb_blocks failed<br>\n"; } else { echo "- Insert into ".$prefix."_nsncb_blocks succeded<br>\n"; }
        $result = $db->sql_query("INSERT INTO ".$prefix."_nsncb_blocks VALUES (5, 2, 1, 'Place Holder', '', 'This is only a place holder', 1, 25)");
        if (!$result) { echo "- Insert into ".$prefix."_nsncb_blocks failed<br>\n"; } else { echo "- Insert into ".$prefix."_nsncb_blocks succeded<br>\n"; }
        $result = $db->sql_query("INSERT INTO ".$prefix."_nsncb_blocks VALUES (6, 2, 2, 'Place Holder', '', 'This is only a place holder', 1, 25)");
        if (!$result) { echo "- Insert into ".$prefix."_nsncb_blocks failed<br>\n"; } else { echo "- Insert into ".$prefix."_nsncb_blocks succeded<br>\n"; }
        $result = $db->sql_query("INSERT INTO ".$prefix."_nsncb_blocks VALUES (7, 2, 3, 'Place Holder', '', 'This is only a place holder', 1, 25)");
        if (!$result) { echo "- Insert into ".$prefix."_nsncb_blocks failed<br>\n"; } else { echo "- Insert into ".$prefix."_nsncb_blocks succeded<br>\n"; }
        $result = $db->sql_query("INSERT INTO ".$prefix."_nsncb_blocks VALUES (8, 2, 4, 'Place Holder', '', 'This is only a place holder', 1, 25)");
        if (!$result) { echo "- Insert into ".$prefix."_nsncb_blocks failed<br>\n"; } else { echo "- Insert into ".$prefix."_nsncb_blocks succeded<br>\n"; }
        $result = $db->sql_query("CREATE TABLE ".$prefix."_nsncb_config (cgid tinyint(1) NOT NULL, enabled tinyint(1) NOT NULL, height smallint(6) NOT NULL, count tinyint(1) NOT NULL, PRIMARY KEY (cgid), UNIQUE cfgid (cgid))");
        if (!$result) { echo "- Create ".$prefix."_nsncb_config failed<br>\n"; } else { echo "- Create ".$prefix."_nsncb_config succeded<br>\n"; }
        $result = $db->sql_query("INSERT INTO ".$prefix."_nsncb_config VALUES( '1', '0', '', '0')");
        if (!$result) { echo "- Insert into ".$prefix."_nsncb_config failed<br>\n"; } else { echo "- Insert into ".$prefix."_nsncb_config succeded<br>\n"; }
        $result = $db->sql_query("INSERT INTO ".$prefix."_nsncb_config VALUES( '2', '0', '', '0')");
        if (!$result) { echo "- Insert into ".$prefix."_nsncb_config failed<br>\n"; } else { echo "- Insert into ".$prefix."_nsncb_config succeded<br>\n"; }
        echo "<hr>\n";
        echo "Operation Complete!<br>\n";
        echo _GOBACK."\n";
        CloseTable();
        include("footer.php");
    break;

    case "1xx-200":
        $pagetitle = "NSN Center Blocks: Upgrade 1.x.x to 2.0.0";
        include("header.php");
        title("$pagetitle");
        OpenTable();
        echo "Operation Status!<br>\n";
        echo "<hr>\n";
        $result = $db->sql_query("ALTER TABLE ".$prefix."_cblocks_config CHANGE cfgid cgid TINYINT(1) DEFAULT '0' NOT NULL");
        if (!$result) { echo "- Alter ".$prefix."_cblocks_config failed<br>\n"; } else { echo "- Alter ".$prefix."_cblocks_config succeded<br>\n"; }
        $result = $db->sql_query("ALTER TABLE ".$prefix."_cblocks_config CHANGE cb_enabled enabled TINYINT(1) DEFAULT '0' NOT NULL");
        if (!$result) { echo "- Alter ".$prefix."_cblocks_config failed<br>\n"; } else { echo "- Alter ".$prefix."_cblocks_config succeded<br>\n"; }
        $result = $db->sql_query("ALTER TABLE ".$prefix."_cblocks_config CHANGE cb_height height SMALLINT(6) DEFAULT '0' NOT NULL");
        if (!$result) { echo "- Alter ".$prefix."_cblocks_config failed<br>\n"; } else { echo "- Alter ".$prefix."_cblocks_config succeded<br>\n"; }
        $result = $db->sql_query("ALTER TABLE ".$prefix."_cblocks_config CHANGE cb_count count TINYINT(1) DEFAULT '0' NOT NULL");
        if (!$result) { echo "- Alter ".$prefix."_cblocks_config failed<br>\n"; } else { echo "- Alter ".$prefix."_cblocks_config succeded<br>\n"; }
        $result = $db->sql_query("ALTER TABLE ".$prefix."_cblocks_config DROP INDEX cfgid, ADD UNIQUE cgid (cgid)");
        if (!$result) { echo "- Alter ".$prefix."_cblocks_config failed<br>\n"; } else { echo "- Alter ".$prefix."_cblocks_config succeded<br>\n"; }
        $result = $db->sql_query("ALTER TABLE ".$prefix."_cblocks_list RENAME ".$prefix."_cblocks_top");
        if (!$result) { echo "- Alter ".$prefix."_cblocks_list failed<br>\n"; } else { echo "- Alter ".$prefix."_cblocks_list succeded<br>\n"; }
        $result = $db->sql_query("CREATE TABLE ".$prefix."_cblocks_bot (cbid tinyint(2) NOT NULL, name varchar(40) NOT NULL, title varchar(40) NOT NULL, wtype tinyint(1) NOT NULL, width smallint(6) NOT NULL, PRIMARY KEY (cbid), UNIQUE cbid (cbid))");
        if (!$result) { echo "- Create ".$prefix."_cblocks_bot failed<br>\n"; } else { echo "- Create ".$prefix."_cblocks_bot succeded<br>\n"; }
        $result = $db->sql_query("INSERT INTO ".$prefix."_cblocks_config VALUES('2', '0', '', '0')");
        if (!$result) { echo "- Insert into ".$prefix."_cblocks_config failed<br>\n"; } else { echo "- Insert into ".$prefix."_cblocks_config succeded<br>\n"; }
        $result = $db->sql_query("INSERT INTO ".$prefix."_cblocks_bot VALUES( '1', '', '', '1', '33')");
        if (!$result) { echo "- Insert into ".$prefix."_cblocks_bot failed<br>\n"; } else { echo "- Insert into ".$prefix."_cblocks_bot succeded<br>\n"; }
        $result = $db->sql_query("INSERT INTO ".$prefix."_cblocks_bot VALUES( '2', '', '', '1', '34')");
        if (!$result) { echo "- Insert into ".$prefix."_cblocks_bot failed<br>\n"; } else { echo "- Insert into ".$prefix."_cblocks_bot succeded<br>\n"; }
        $result = $db->sql_query("INSERT INTO ".$prefix."_cblocks_bot VALUES( '3', '', '', '1', '33')");
        if (!$result) { echo "- Insert into ".$prefix."_cblocks_bot failed<br>\n"; } else { echo "- Insert into ".$prefix."_cblocks_bot succeded<br>\n"; }
        echo "<hr>\n";
        echo "Operation Complete!<br>\n";
        echo _GOBACK."\n";
        CloseTable();
        include("footer.php");
    break;

    case "200-201":
        $pagetitle = "NSN Center Blocks: Upgrade 2.0.0 to 2.0.1";
        include("header.php");
        title("$pagetitle");
        OpenTable();
        echo "Operation Status!<br>\n";
        echo "<hr>\n";
        $result = $db->sql_query("ALTER TABLE ".$prefix."_cblocks_bot RENAME ".$prefix."_nsncb_bot");
        if (!$result) { echo "- Alter ".$prefix."_cblocks_bot failed<br>\n"; } else { echo "- Alter ".$prefix."_cblocks_bot succeded<br>\n"; }
        $result = $db->sql_query("ALTER TABLE ".$prefix."_cblocks_config RENAME ".$prefix."_nsncb_config");
        if (!$result) { echo "- Alter ".$prefix."_cblocks_config failed<br>\n"; } else { echo "- Alter ".$prefix."_cblocks_config succeded<br>\n"; }
        $result = $db->sql_query("ALTER TABLE ".$prefix."_cblocks_top RENAME ".$prefix."_nsncb_top");
        if (!$result) { echo "- Alter ".$prefix."_cblocks_top failed<br>\n"; } else { echo "- Alter ".$prefix."_cblocks_top succeded<br>\n"; }
        echo "<hr>\n";
        echo "Operation Complete!<br>\n";
        echo _GOBACK."\n";
        CloseTable();
        include("footer.php");
    break;

    case "201-210":
        $pagetitle = "NSN Center Blocks: Upgrade 2.0.1 to 2.1.0";
        include("header.php");
        title("$pagetitle");
        OpenTable();
        echo "Operation Status!<br>\n";
        echo "<hr>\n";
        $result = $db->sql_query("CREATE TABLE ".$prefix."_nsncb_blocks (rid tinyint(2) NOT NULL default '0', cgid tinyint(2) NOT NULL default '0', cbid tinyint(2) NOT NULL default '0', title varchar(60) NOT NULL default '', filename varchar(255) NOT NULL default '', content text NOT NULL, wtype tinyint(1) NOT NULL default '0', width smallint(6) NOT NULL default '0', PRIMARY KEY  (rid), UNIQUE KEY rid (rid))");
        if (!$result) { echo "- Create ".$prefix."_nsncb_blocks failed<br>\n"; } else { echo "- Create ".$prefix."_nsncb_blocks succeded<br>\n"; }
        $change1 = $db->sql_query("SELECT * FROM ".$prefix."_nsncb_top ORDER BY cbid");
        $rid = 1;
        while($cbtop = $db->sql_fetchrow($change1)) {
            $result = $db->sql_query("INSERT INTO ".$prefix."_nsncb_blocks VALUES ($rid, 1, ".$cbtop['cbid'].", '".$cbtop['title']."', '".$cbtop['name']."', '', ".$cbtop['wtype'].", ".$cbtop['width'].")");
            if (!$result) { echo "- Insert into ".$prefix."_nsncb_blocks failed<br>\n"; } else { echo "- Insert into ".$prefix."_nsncb_blocks succeeded<br>\n"; }
            $rid++;
        }
        $result = $db->sql_query("INSERT INTO ".$prefix."_nsncb_blocks VALUES (4, 1, 4, '----', '', '----', 0, 0)");
        if (!$result) { echo "- Insert into ".$prefix."_nsncb_blocks failed<br>\n"; } else { echo "- Insert into ".$prefix."_nsncb_blocks succeded<br>\n"; }
        $change2 = $db->sql_query("SELECT * FROM ".$prefix."_nsncb_bot ORDER BY cbid");
        $rid = 5;
        while($cbbot = $db->sql_fetchrow($change2)) {
            $result = $db->sql_query("INSERT INTO ".$prefix."_nsncb_blocks VALUES ($rid, 2, ".$cbbot['cbid'].", '".$cbbot['title']."', '".$cbbot['name']."', '', ".$cbbot['wtype'].", ".$cbbot['width'].")");
            if (!$result) { echo "- Insert into ".$prefix."_nsncb_blocks failed<br>\n"; } else { echo "- Insert into ".$prefix."_nsncb_blocks succeeded<br>\n"; }
            $rid++;
        }
        $result = $db->sql_query("INSERT INTO ".$prefix."_nsncb_blocks VALUES (8, 2, 4, '----', '', '----', 0, 0)");
        if (!$result) { echo "- Insert into ".$prefix."_nsncb_blocks failed<br>\n"; } else { echo "- Insert into ".$prefix."_nsncb_blocks succeded<br>\n"; }
        $result = $db->sql_query("DROP TABLE ".$prefix."_nsncb_bot");
        if (!$result) { echo "- Drop ".$prefix."_nsncb_bot failed<br>\n"; } else { echo "- Drop ".$prefix."_nsncb_bot succeded<br>\n"; }
        $result = $db->sql_query("DROP TABLE ".$prefix."_nsncb_top");
        if (!$result) { echo "- Drop ".$prefix."_nsncb_top failed<br>\n"; } else { echo "- Drop ".$prefix."_nsncb_top succeded<br>\n"; }
        echo "<hr>\n";
        echo "Operation Complete!<br>\n";
        echo _GOBACK."\n";
        CloseTable();
        include("footer.php");
    break;

    case "destall":
        $pagetitle = "NSN Center Blocks: Destall";
        include("header.php");
        title("$pagetitle");
        OpenTable();
        echo "Operation Status!<br>\n";
        echo "<hr>\n";
        $result = $db->sql_query("DROP TABLE ".$prefix."_nsncb_blocks");
        if (!$result) { echo "- Destall ".$prefix."_nsncb_blocks failed<br>\n"; } else { echo "- Destall ".$prefix."_nsncb_blocks succeded<br>\n"; }
        $result = $db->sql_query("DROP TABLE ".$prefix."_nsncb_config");
        if (!$result) { echo "- Destall ".$prefix."_nsncb_config failed<br>\n"; } else { echo "- Destall ".$prefix."_nsncb_config succeded<br>\n"; }
        echo "<hr>\n";
        echo "Operation Complete!<br>\n";
        echo _GOBACK."\n";
        CloseTable();
        include("footer.php");
    break;

}
} else {
    $pagetitle = "NSN Center Blocks: ERROR";
    include("header.php");
    title("$pagetitle");
    OpenTable();
    echo "<center><b>Sorry, ONLY super admins may run this script</b><center>\n";
    CloseTable();
    include("footer.php");
}
?>


html/nsncb.php ---------------------> sql installer/destaller/upgrader.

I use cpanel 7 ...is sql installer something separate I need to upload to execute the nsncb.php?
Here is the code for the nsncb_func.php file.


<?php

/********************************************************/
/* NSN Center Blocks(TM) Universal                      */
/* By: NukeScripts Network (webmaster@nukescripts.net)  */
/* http://www.nukescripts.net                           */
/* Copyright © 2000-2005 by NukeScripts Network         */
/********************************************************/

function cb_blocks($rid) {
    global $prefix, $db, $admin, $user;
    $sql = "SELECT * FROM ".$prefix."_nsncb_blocks WHERE rid='$rid'";
    $result = $db->sql_query($sql);
    while($row = $db->sql_fetchrow($result)) {
        $title = $row['title'];
        $filename = $row['filename'];
        $content = $row['content'];
        if ($filename == "" AND $content > "") {
            themecenterbox($title, $content);
        } elseif ($filename > "" AND $content == "") {
            $file = @file("blocks/$filename");
            if (!$file) {
                $content = _BLOCKPROBLEM;
            } else {
                include("blocks/$filename");
            }
            if ($content == "") { $content = _BLOCKPROBLEM2; }
            themecenterbox($title, $content);
        } elseif ($filename == "" AND $content == "") {
            $content = _BLOCKPROBLEM2;
            themecenterbox($title, $content);
        }
    }
}

?>


one more thing....the instructions mention a "mainfile.txt"

html/mainfile.txt ------------------> copy and paste the routine into your mainfile.php


There is not mainfile.txt included in the zipfile I downloaded...and I downloaded it twice to make sure. I asked about this over at NSN and have not gotten a response yet...I was hoping someone here can help out. Thanks in advance!


Back to top Reply with quote
#2   
Gareth
CZ Addict
 Codezwiz Site Donator
Gareth has been a member for over 20 year's 20 Year Member
uk.gif
Occupation: Student, Webmaster
Gender: Male
Fav. Sports Team: Liverpool FC
Status: Offline
Joined: May 29, 2004
0.08 posts per day
Posts: 587
Points: 38,220
   
Fatal error: Cannot redeclare cb_blocks() (previously declared in /home/site/public_html/includes/nsncb_func.php:10) in /home/site/public_html/includes/nsncb_func.php on line 10


That means its already been included or required in a file, probably mainfile.php but i dont know where

Gareth



_________________
[ Register or login to view links on this board.]
Back to top Reply with quote
#3   re: Fatal Error....PLEASE HELP....NSN UNIVERSAL CENTER BLOCK
Dobie1
CZ Newbie
Dobie1 has been a member for over 19 year's 19 Year Member
Gender: Male
Status: Offline
Joined: Jan 05, 2005
0.00 posts per day
Posts: 2
Points: 546
   
Thanks ....that helped alot...I can see my site again...now my only problem is the addon is not appearing...I ran the nsncb.php file and executed it....Thanks to Gareth for that. The only thing now is I don't see the addon in my admin menu...not even the admin icon for the addon....anyway these problems now seem minor.



Back to top Reply with quote
Display posts from previous:      
Add To: Del.icio.us  Digg  Google  Spurl  Blink  Furl  Y! MyWeb  
<< View previous topic View next topic >>
Post new topicReply to topic

Jump to 
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 cannot attach files in this forum
You cannot download files in this forum