Log in

View Full Version : How to show acvtive users from non - VB pages?


xBhp
03-23-2005, 05:21 AM
I have got a website integerated with VB. I have quite a few non - VB pages. i want that whenever users are browing those pages they should also show up in the active users list.

is there a way to do that ?
regards
Edit/Delete Message

Marco van Herwaarden
03-23-2005, 06:43 AM
As long as you include global.php in your script, a vB session will be set and the user will show logged in i think.

xBhp
03-23-2005, 02:25 PM
i included the global.php in a file in a folder one up of the forum folder. i got this error:

Warning: main(/talkies/global.php): failed to open stream: No such file or directory in /home2/xbhp1/public_html/posts.php on line 1

Warning: main(/talkies/global.php): failed to open stream: No such file or directory in /home2/xbhp1/public_html/posts.php on line 1

Warning: main(): Failed opening '/talkies/global.php' for inclusion (include_path='.:/usr/lib/php:/usr/local/lib/php') in /home2/xbhp1/public_html/posts.php on line 1

I reckoned that this must be a relative path error, but it wasnt. no use of removing the starting backslash either. please help.

Marco van Herwaarden
03-23-2005, 03:04 PM
You will need to do a chdir to your forum directory prior to calling teh global.php.

chdir("./forum");
require_once("./global.php);If needed chdit back after the global.

xBhp
03-26-2005, 10:28 AM
i did what u said and it seemed to work, but i got this error: "Unable to add cookies, header already sent.
File: /home2/xbhp1/public_html/posts.php
Line: 3"

but when i cleared cookies the page showed up fine. if i add this code to every page it wont be possible to tell the non tech savvy users to clear the cookiea and relogin to hget rid of this unfreindly message.

Dean C
03-26-2005, 11:46 AM
Make sure you have no page output before you put Marco's code there. Also make sure there is no spaces before the <?php at the top of the page :)

xBhp
03-26-2005, 01:44 PM
You will need to do a chdir to your forum directory prior to calling teh global.php.

chdir("./forum");
require_once("./global.php);If needed chdit back after the global.


i tried to figure out how to chdir back. this is the php code i used but of no avail.

<?PHP
$dir = getcwd();
chdir("../../talkies");
print $dir;
require_once("global.php");
chdir($dir);

?>

its throwing an error.

Warning: chdir(): No such file or directory (errno 2) in /home2/xbhp1/public_html/broadband/fotos/index.php on line 6