vb.org Archive

vb.org Archive (https://vborg.vbsupport.ru/index.php)
-   vB3 Programming Discussions (https://vborg.vbsupport.ru/forumdisplay.php?f=15)
-   -   Dir in forum directory (getting global.php stuff) (https://vborg.vbsupport.ru/showthread.php?t=56272)

Dean C 08-17-2003 02:33 PM

Dir in forum directory (getting global.php stuff)
 
If i have a directory in my forum directory like so:

forums/mydir

And i want to include global.php from the forums directory and use its values in my index.php in mydir what code do I use. I've tried using chdir but to no effect.

Any ideas on how I can get it :)?

- miSt

filburt1 08-17-2003 02:37 PM

PHP Code:

require("../global.php"); 


Dean C 08-17-2003 03:50 PM

PHP Code:

<?php

error_reporting
(7);
require(
"../global.php");

echo 
$bburl;

?>

That's all my code just for testing purposes at the moment but it's just displaying a blank page :(

Gavin B. 08-18-2003 09:04 PM

Does that give you an error? It should if it can't include it (may have to comment out the error reporting line to see)...

Perhaps ../forum/config.php ? if not... you may need to use the real path - ie /home/users/public_html/forum/

assassingod 08-18-2003 09:09 PM

Using the full path wont work, i've tried it (many times)

filburt1 08-18-2003 09:39 PM

Try combinations of chdir'ing and then require'ing. :)

SmEdD 08-18-2003 11:08 PM

/forums/mydir

Gavin B. 08-18-2003 11:25 PM

Quote:

Yesterday at 11:09 PM assassingod said this in Post #5
Using the full path wont work, i've tried it (many times)

I meant the real server path... not http://www.example.com/forum/config.php because more than likely it will give you a seeking not allowed error in that case ;)

Dean C 08-19-2003 11:50 AM

Make a directory in your forums directory called 'moo'.

Then upload this as your index.php file:

PHP Code:

<?php 

error_reporting
(7); 
require(
"../global.php"); 

echo 
$bburl

?>

$bburl being a global variable should be outputted to the page...

I see nothing :(

Gavin B. 08-19-2003 12:19 PM

Ah I see what it's doing. It is trying to include ./admin/config.php relative to the /forum/folder/ directory... not sure if I have a solution for that unless you just copy paste the global.php file into your new directory and alter the line where it includes config.php to point.

NTLDR 08-19-2003 01:49 PM

The simplest way would be to create a symlink in moo to global.php and to forums/admin.

Or:

PHP Code:

chdir('../'); 


Dean C 08-19-2003 02:46 PM

So i put that line before requiring global.php right? ^^

Gavin B. 08-19-2003 02:49 PM

I don't know if that will work, but worth a shot.
I thought changing the include path would work, (ie ini_set('include_path', '.:/path/to/script/here/'); but on *nix boxes apparently is doesn't work with files included within an include. :(

SmEdD 08-19-2003 03:05 PM

$vbpath ="/path/to/folder/with/global/in/it";
chdir($vbpath);
require_once("global.php");

or like NTLDR said


All times are GMT. The time now is 07: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.01030 seconds
  • Memory Usage 1,742KB
  • 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
  • (4)bbcode_php_printable
  • (1)bbcode_quote_printable
  • (1)footer
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (6)option
  • (1)post_thanks_navbar_search
  • (1)printthread
  • (14)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