PDA

View Full Version : Dir in forum directory (getting global.php stuff)


Dean C
08-17-2003, 02:33 PM
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
require("../global.php");

Dean C
08-17-2003, 03:50 PM
<?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
Yesterday at 11:09 PM assassingod said this in Post #5 (https://vborg.vbsupport.ru/showthread.php?postid=426890#post426890)
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

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:

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