Go Back   vb.org Archive > vBulletin 3 Discussion > vB3 General Discussions
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools Display Modes
  #1  
Old 08-30-2001, 07:49 AM
Pyro Pyro is offline
 
Join Date: May 2002
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Hi there,

I included several hacks on my index_homepage.php3 which is a non-vB page outside the vB directory:

Who's online on non-vB page
http://vbulletin.com/forum/showthrea...threadid=12010

Last XX Posts on non-vB page
http://vbulletin.com/forum/showthrea...threadid=12324


Total Posts on a non-vbb page
http://vbulletin.com/forum/showthrea...threadid=24226

Total Threads on a non-vbb page
http://vbulletin.com/forum/showthrea...threadid=24227


All work fine, I got all problems like "cannot include global.php3" and "cannot add more header informations" solved with the great help of this community.

Now I came to this error:

Fatal error: Cannot redeclare class db_sql_vb in ./admin/db_mysql.php3 on line 7

when I try to include the following hacks in that page:

Show Events on non-vb page
http://vbulletin.com/forum/showthrea...ghlight=events

Homepage Login on non-vB page
http://vbulletin.com/forum/showthrea...threadid=23524


Ok, I can roughly imagine what happened but cannot solve the problem. The hacks work fine on a single page but I cannot include them in the page where the other hacks are included. What do I have to change/delete in the last hacks to make them run properly?

As always - many thanks for your help and best regards,
Markus
Reply With Quote
  #2  
Old 08-30-2001, 08:04 AM
merk merk is offline
 
Join Date: Nov 2001
Location: Canberra, Australia
Posts: 601
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Im guessing, its simply as you include these hacks, they incude certain files, ie functions.php

or something, and as a second one trys to call it, they fail.

Have a look thru your files, and make sure global.php(3 in your case) is only called _once_.

Thats really the only file it should be calling.
Reply With Quote
  #3  
Old 08-30-2001, 12:52 PM
Wayne Luke's Avatar
Wayne Luke Wayne Luke is offline
Senior Member
 
Join Date: Jan 2002
Location: Southern California
Posts: 1,694
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Change all the include() statements to include_once() statements.
Reply With Quote
  #4  
Old 09-03-2001, 02:28 PM
Pyro Pyro is offline
 
Join Date: May 2002
Posts: 9
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally posted by wluke
Change all the include() statements to include_once() statements.
Hi there,

thank you for your quick help but it didn't solve my problem. I exchanged all require() and include() to include_once() but the error still occurs:

Fatal error: Cannot redeclare class db_sql_vb in ./admin/db_mysql.php3 on line 7

I guess, it has something to do with those two hacks and with the $DB_site in it.

NUMBER OF POSTS AND THREADS on non-vB page
PHP Code:
<?php

include_once("./admin/config.php3");

$dbclassname="./admin/db_$dbservertype.php3";
require(
$dbclassname);

$DB_site=new DB_Sql_vb;

$DB_site->appname="VBulletin";
$DB_site->appshortname="VBulletin (forum)";
$DB_site->database=$dbname;
$DB_site->server=$servername;
$DB_site->user=$dbusername;
$DB_site->password=$dbpassword;

$DB_site->connect();


$numbersposts=$DB_site->query_first("SELECT COUNT(postid) AS posts FROM post");
$numberposts=$numbersposts[posts];

$numbersthreads=$DB_site->query_first("SELECT COUNT(threadid) AS threads FROM thread");
$numberthreads=$numbersthreads[threads];

 echo 
"posts: $numberposts <br>threads: $numberthreads <br>";

mysql_close();
?>

CALENDAR EVENTS on non-vB page
PHP Code:
<?php

include_once('./global.php3');
  
$events $DB_site->query("SELECT DATE_FORMAT(eventdate,'%b %d') AS date, eventid, subject
                           FROM calendar_events
                           WHERE public = 1 AND eventdate >= '"
.vbdate('Y-m-d',time())."'
                           ORDER BY eventdate LIMIT 5"
);
if (
$DB_site->num_rows($events)) {
  echo 
"Next Five Events:<br>";
  while (
$event $DB_site->fetch_array($events)) {
    echo 
"<a href='./forum/calendar.php3?s=$session[sessionhash]&action=getinfo&eventid=$event[eventid]'>$event[subject]</a><br>";
  }
} else {
  echo 
"No Events";
}
?>

Where is the problem and what would be an easy work around for it?

Thank you!!!
Markus
Reply With Quote
  #5  
Old 09-03-2001, 02:46 PM
badmeetsevil-'s Avatar
badmeetsevil- badmeetsevil- is offline
 
Join Date: Oct 2001
Posts: 39
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Change

PHP Code:
$DB_site=new DB_Sql_vb
to

PHP Code:
$DB_site="new DB_Sql_vb"
That should fix it.
Reply With Quote
  #6  
Old 09-03-2001, 02:48 PM
badmeetsevil-'s Avatar
badmeetsevil- badmeetsevil- is offline
 
Join Date: Oct 2001
Posts: 39
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Also, in the script, change .php3 to .php for include_once and the db class name.
Reply With Quote
Reply


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

Forum Jump


All times are GMT. The time now is 03:01 PM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.03741 seconds
  • Memory Usage 2,226KB
  • Queries Executed 11 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (1)ad_showthread_firstpost
  • (1)ad_showthread_firstpost_sig
  • (1)ad_showthread_firstpost_start
  • (4)bbcode_php
  • (1)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)navbar
  • (3)navbar_link
  • (120)option
  • (6)post_thanks_box
  • (6)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (6)post_thanks_postbit_info
  • (6)postbit
  • (6)postbit_onlinestatus
  • (6)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete