Page 1 of 1
phpbb login check on custom pages
Posted: Mon May 23, 2005 12:25 pm
by Bomas
I'm making a script for somebody and he wants a login, but when you log in to the site, you must also be logged in on the phpbb-forum.
I've been tying to make a script for days, but it doesn't work. Does anybody know any script to check wether you're online or not.
people told me to use this:
Code: Select all
define('IN_PHPBB', true);
$phpbb_root_path = './';
include($phpbb_root_path . 'extension.inc');
include($phpbb_root_path . 'common.'.$phpEx);
//
// Start session management
//
$userdata = session_pagestart($user_ip, PAGE_INDEX);
init_userprefs($userdata);
//
// End session management
//
if($userdata['session_logged_in']){
/*
myscript running here
*/
}else{
die("Not logged in stuff");
}
but that only works on phpbb-pages itself, and not on my costum pages.
all help is welkom
thx
Posted: Mon May 23, 2005 12:39 pm
by Skara
I haven't worked much with phpbb yet, but it sounds to me like you're just missing something. If you include all of the login code into any other page, it should work.
Posted: Mon May 23, 2005 1:05 pm
by Burrito
make sure you're including the page with session info.
do a search for session_start() and just include that file.
the other alternative would be to set the phpBB cookie and just use that...or set another cookie for your other site stuff and use that.
Posted: Mon May 23, 2005 2:32 pm
by phpScott
check out this
viewtopic.php?t=27589 as it has an example on how to do it.
Posted: Mon May 23, 2005 9:43 pm
by Sphen001
Posted: Tue May 24, 2005 3:44 pm
by Bomas
Burrito wrote:make sure you're including the page with session info.
do a search for session_start() and just include that file.
the other alternative would be to set the phpBB cookie and just use that...or set another cookie for your other site stuff and use that.
I did, and it was located in the page: sessions.php, which is included in the page common.php. so it should run the page. The weird thing is, it doesn't isplay anything, it just keep running the rest of the script.
that's the site i got the code from. but that doesn't work.
i've used the code u guys posted on the other topic, but that doesn't work either. It says session_logged_in = 0
i still don't get it
Posted: Tue May 24, 2005 4:54 pm
by neophyte
Are you sure you are on the right domain. If you're forum domain is "forum.somesite.com" but your custom page on domain "somesite.com" you may not be accessing the right cookie. Thus you're not logged in. It can even be as subtle as "
www.somesite.com" and "somesite.com".
Eh, you probably already thought of this...
Hope this helps
Posted: Wed May 25, 2005 1:09 pm
by Bomas
i checked. the forum is located in the map ./forum/
and the session_start() is located in the map ./forum/includes, but that's the standard dir for phpbb
i haven't got a single clue of where the problem is located
Posted: Wed May 25, 2005 1:13 pm
by Sphen001
Well, where is your page in relation to the forum? If it isn't already, try putting your file in the root phpBB folder and see if that works.
Sphen001