vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 General Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=111)
-   -   $DB_site not recognised. (https://vborg.vbsupport.ru/showthread.php?t=81725)

Xia 05-19-2005 12:20 PM

$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:
PHP Code:

chdir'../../public_html/forums' );
require_once(
'global.php'); 


Xia 05-19-2005 12:24 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

AN-net 05-19-2005 04:43 PM

Quote:

Originally Posted by Xia
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;

Xia 05-19-2005 06:49 PM

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

Xia 05-23-2005 10:04 AM

Can anyone help?

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...

jugo 05-23-2005 08:06 PM

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.


All times are GMT. The time now is 01:41 AM.

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.01011 seconds
  • Memory Usage 1,728KB
  • Queries Executed 10 (?)
More Information
Template Usage:
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (9)printthreadbit
  • (1)spacer_close
  • (1)spacer_open 

Phrase Groups Available:
  • global
  • postbit
  • showthread
Included Files:
  • ./printthread.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/class_bbcode_alt.php
  • ./includes/class_bbcode.php
  • ./includes/functions_bigthree.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
  • printthread_start
  • bbcode_fetch_tags
  • bbcode_create
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • printthread_post
  • printthread_complete