Firefox PHP

Using Phorum logins

Posted by Steve Healy 
Using Phorum logins
December 27, 2007 10:58PM
I use the following method of requiring phorum logins on my site in several places:

$pwd = getcwd();
chdir("../forum");
define('phorum_page', 'my_page');
include_once("./common.php"); 
phorum_require_login();
chdir($pwd);
unset($pwd);
echo "hi ",$PHORUM["user"]["username"];


It works as long as the person is already logged into the forum. I have problems though when they access a page in another directory without being logged in:

It tries to redirect them to login.php in the wrong directory. (thus giving a 404 error)

Any advice?
Re: Using Phorum logins
December 28, 2007 12:32AM
what is your HTTP Path set to in the General Settings?

Brian - Cowboy Ninja Coder - Personal Blog - Twitter
Re: Using Phorum logins
December 28, 2007 12:54AM
path in general settings:

http://www.my_domain.com/forum



files with includes are in another folder like:

http://www.my_domain.com/other/include.php
Re: Using Phorum logins
December 28, 2007 01:02AM
Here is the (failing) redirect URL I get:

http://www.my_domain.com/other/login.php?0,redir=http%3A%2F%2Fwww.my_domain.com%2Fother%2Finclude.php%3F


If I simply change the first occurrence of "other" to "forum" in the URL, everything works nicely.
Re: Using Phorum logins
December 28, 2007 11:01AM
Are you using something like the automatic http_path module or the virtual hosting module? Those will dynamically try to find out the Phorum http path based on the currently requested URL. It seems like your setup is doing something like this.


Maurice Makaay
Phorum Development Team
my blog linkedin profile secret sauce
Re: Using Phorum logins
December 28, 2007 06:35PM
Ahh. Yes, indeed. I am using the Automatic HTTP Path module.

I tried turning it off and the behavior changed slightly, but still broken. Now I get redirected to the correct login page, but when I have logged in it tries to return me to the page I came from within the forum directory, rather than the originating directory. Thus:

http://www.my_domain.com/forum/login.php?0,redir=http%3A%2F%2Fwww.my_domain.com%2Fforum%2Finclude.php%3F

What I need is this:

http://www.my_domain.com/forum/login.php?0,redir=http%3A%2F%2Fwww.my_domain.com%2Fother%2Finclude.php%3F
Sorry, only registered users may post in this forum.

Click here to login