View Full Version : $DB_site not recognised.
I'm trying to log in from another part of my website.
I do this:
chdir ( '../../public_html/forums' );
require_once 'global.php';
And get this error:
Fatal error: Call to a member function on a non-object in /home/wa/public_html/forums/includes/sessions.php on line 73
Which is on a $DB_site line call..
I checked in includes/init.php and the $DB_site object is created just fine. Why isn't it accessible from within sessions.php?
Thanks!
Marco van Herwaarden
05-19-2005, 12:22 PM
Change to:
chdir( '../../public_html/forums' );
require_once('global.php');
uhm, what's the difference?
Update: I can access it fine in Sessions.php but not in the function build_session..
In that function it is defined as global $DB_site; so I don't understand why it wouldn't work. I echoed out the contents of $DB_site just before the call to the function and in the function. Works fine before, but is empty when inside the function.
Any ideas what is causing this?
Thanks
AN-net
05-19-2005, 04:43 PM
uhm, what's the difference?
Update: I can access it fine in Sessions.php but not in the function build_session..
In that function it is defined as global $DB_site; so I don't understand why it wouldn't work. I echoed out the contents of $DB_site just before the call to the function and in the function. Works fine before, but is empty when inside the function.
Any ideas what is causing this?
Thanks
um the difference is that require_once requires parentheses. also if you can not echo a class or mysql query. it may not be recognized in your new function because you must use global $DB_site;
Require_once doesn't require parentheses..There is no difference in using them or not, it may not be best coding practices, but it works. However, thanks for pointing that out.
Now, this function isn't new, it's build_session from sessions.php and it already has global $DB_site as I pointed out in my previous post. Any other ideas? Thanks
Marco van Herwaarden
05-23-2005, 11:08 AM
Well maybe you should try to show a bit more of your script. Very hard to give a solution (or even understand your problem) by just 2 lines.
akanevsky
05-23-2005, 06:40 PM
" chdir( '../../public_html/forums' ); "
^^ What the hell is this? Of course you would get errors if you try to exit the root directory like this.. Where is your script located? If it is in root, then use:
chdir( './forums' );
If, for example, it is in public_html/somefolder, use:
chdir( '../forums' );
But do not ever tell your script to go deeper than public_html...
I wonder how you don't get a fatal error...
You need to show a bit more of your code in order for a proper answer to be given. I have a feeling.....
show me some code and i'll see if I can help.
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.