PDA

View Full Version : $vbulletin->db is not an object


miguel.simoes
08-16-2005, 04:22 PM
Hy,

I'm trying to make an outside login for the user, without the user having to be on the forum or even to be redirected inside it. But, there is a problem...

When using:

chdir('./forum/');
require_once('./global.php');

I get:

Fatal error: Call to a member function query_first() on a non-object in [path]\forum\includes\functions.php on line 1533

Fatal error: Call to a member function unlock_tables() on a non-object in [path]\forum\includes\functions.php on line 4240



So, I went to debug it with:
if(!is_object($vbulletin) die ("Not object");

and guess the result? :rolleyes: Not Object.

When using the vbulletin normally no problem is reached, but when including any file (example: global.php or login.php) I get the same error.

What can be wrong? The things I was seeing in the forum where related with the case-sensitive issue of Linux, but in this case you can't miss it... all lowercase.

Can someone give me a hand?


Best regards,
Miguel Sim?es

amykhar
08-16-2005, 04:51 PM
If it's within a function, you will need to do a global $vbulletin; or global $db; to get it in scope.

Amy

Zero Tolerance
08-16-2005, 04:56 PM
Change:
chdir('./forum/');
To:
chdir('./forum');

Should work then :)

- Zero Tolerance

miguel.simoes
08-16-2005, 05:24 PM
amykhar:

This is a VB function, not mine :squareeyed: I'm just making (until now) the include of global.php and already getting errors.


Zero Tolerance:
Nothing change :| I had the same issue before, when using the 3.0.X versions. I'm using PHP5 and I've been reading the Documentation of VB, but it only tells the "latest PHP version", so I assume that it is PHP5 compilant, even if not using a OOP structure (public, private, extends, etc... are not used).

just a note: chdir('./forum/') or chdir('./forum') or chdir('forum/') are the same thing :)

Hmmm... Just created a script with:

error_reporting(E_ALL & ~E_NOTICE);
chdir('forum/');
require_once('global.php');

And it works... nothing more. I guess that some other code within my application that is messing around with VB. But what can it be? :|

Thankx for the tip anyway.



Best regards,
Miguel Sim?es