1 (edited by Slicky 2005-10-15 17:44)

Topic: Adding two cookie domains?

I have my forum in a sub domain of my main site. I would like the forum to show guests, users online even when these users are not in the forum, but online in the main site.

Any ideas how this could be done?

Would I alter the,
$cookie_domain = '';
$cookie_path = '/';
in the config.php?
Thanks

2

Re: Adding two cookie domains?

Not sure hat exactly you want to do.
You want to show the forum to people using www.yourhost.com as well as sub.yourhost.com?

Then it's OK to write
$cookie_domain = 'yourhost.com';

The German PunBB Site:
PunBB-forum.de

Re: Adding two cookie domains?

Thanks Tobi,
The forum is in a sub domain of my main site. I want the forum to show users online even when they are not on the forum. I want the forum to show them, guests & members when they are browsing my main site.
Example,
I if I go to the main site, in the forum it would show me as online.

I tried the above but it didnt work.
Hmm

4

Re: Adding two cookie domains?

Oh, that's what you mean... for that to work you must incorporate the online check of PunBB in your main site as well.
It's all hiddden in include/functions.php.
Don't know if it's that easy but it should be no science as well..

The German PunBB Site:
PunBB-forum.de

Re: Adding two cookie domains?

Thanks again,
Will pick through it..

6 (edited by Slicky 2005-10-16 22:28)

Re: Adding two cookie domains?

Well, I tried for the last few hours and still no idea...
Has anyone done this before?

Thinking it must be in the define('PUN_ROOT', './test/')
Because it a sub domain and not a /folder of the main site. If this is it, how should I display it in the pun_root?
Thanks

7 (edited by Tobi 2005-10-17 07:35)

Re: Adding two cookie domains?

I'm not 100% sure but I think these three lines in your index file will do:

define('PUN_ROOT', './');
require PUN_ROOT.'include/common.php';
require PUN_ROOT.'lang/'.$pun_user['language'].'/index.php';

and PUN_ROOT has to be changed to the installation dir of your forum, like

define('PUN_ROOT', './my_board/');

Then, on the bottom of your page you can put the stuff from index.php line 177ff.

The German PunBB Site:
PunBB-forum.de

Re: Adding two cookie domains?

Thanks again Tobi,
I gave it a go! I made a seperate page in my main domains folder (not the forums folder) with the above code, editing it with my sites info. I then added to it,  echo $lang_index['Newest user'] ?> etc.... to see if it loged me in or not. It did show users online who where in the forum, but it would not show me as online/loged in.
I am stumped!

9

Re: Adding two cookie domains?

So, *where* you logged in when you tested then?
Because when it showed the other users I see no reason why it didn't show you - unless you hadn't logged in.

The German PunBB Site:
PunBB-forum.de

10 (edited by Slicky 2005-10-18 11:09)

Re: Adding two cookie domains?

The problem is, I have to be in the forum subdomain to show up on the forum loged in list.
When I enter the forum, I am logged in. I would like that same cookie to log me in when I look at other pages in the main site, when I am out of the forum subdomain.
lets say I am in punbb.org/, at forums.punbb.org/ it shows me as online. That what I am after.

11

Re: Adding two cookie domains?

Oh, I see.
But actualy it should work if the cookie is set correctly.
This could be a mistake in my previous posting.

The line in config.php must be

$cookie_domain = '.yourhost.com';

not

$cookie_domain = 'yourhost.com';

(Note the leading dot)
Delete your current cookie and try that one.

The German PunBB Site:
PunBB-forum.de

12

Re: Adding two cookie domains?

Damn....That means that for it to work now, I would have to ask everyone who has ever logged in to delete cookies...Nothing is easy!
Thanks for you help/time Tobi, appreciated.

13

Re: Adding two cookie domains?

Slicky wrote:

Damn....That means that for it to work now, I would have to ask everyone who has ever logged in to delete cookies..

Guess so.... sad

There is only the alternative of setting up a redirect from your www.yoursite.com/index.php to something like forum.yoursite.com/content.php.
That way people will be in the "right" domain but it is neither very elegant nor search engine friendly.

The German PunBB Site:
PunBB-forum.de