Be Excellent To Each Other
https://www.beexcellenttoeachother.com/forum/

PHP help - integrating login with phpBB3
https://www.beexcellenttoeachother.com/forum/viewtopic.php?f=3&t=1375
Page 1 of 1

Author:  GazChap [ Mon Jul 21, 2008 16:21 ]
Post subject:  PHP help - integrating login with phpBB3

Any of you excellent PHP dudes got any code that I can use to login to a phpBB3 forum from a site on the same server?

It needs to be something that doesn't make extensive use of the actual phpBB resources, as whenever I try and do that it doesn't work.

Author:  Grim... [ Tue Jul 22, 2008 11:23 ]
Post subject:  Re: PHP help - integrating login with phpBB3

Er... The login page of PHPBB3 works quite well.
What are you trying to do?

Author:  GazChap [ Tue Jul 22, 2008 11:49 ]
Post subject:  Re: PHP help - integrating login with phpBB3

There's a website I'm doing that's based on my own CMS framework. So there is already a login/register function on that framework that works.

They want to add a forum in, and to simplify things I want forum accounts to be created when someone registers on the main site, and when someone logs in on the main site the account on the forum gets logged in too.

I've already linked up the registration processes but the login just doesn't want to work. I have an idea why, but I'm not sure.

The reason for doing this is that the register/login features of the forum software itself will be removed so everything is done through the main site.

Author:  Grim... [ Tue Jul 22, 2008 11:56 ]
Post subject:  Re: PHP help - integrating login with phpBB3

Is it cookies? This forum seems like an arse with cookies.
I take it you've copied most of the code you need from the forum's login page?

Author:  GazChap [ Tue Jul 22, 2008 12:01 ]
Post subject:  Re: PHP help - integrating login with phpBB3

I suspect it's something to do with the cookies, but bizarrely the forum doesn't create any so perhaps it's the session instead.

Author:  Grim... [ Tue Jul 22, 2008 12:04 ]
Post subject:  Re: PHP help - integrating login with phpBB3

It er... You what? I can assure you it should.
I take it you can log into the forum okay using the forum login?

Author:  GazChap [ Tue Jul 22, 2008 12:08 ]
Post subject:  Re: PHP help - integrating login with phpBB3

Yeah, it all works OK using the forum login but even checking the list of cookies in Firefox shows that it hasn't created any.

Spooky.

Author:  Grim... [ Tue Jul 22, 2008 12:11 ]
Post subject:  Re: PHP help - integrating login with phpBB3

What do you have in the 'cookie settings' on the first page of the ACM (on the left, right near the bottom)?

Author:  GazChap [ Thu Jul 24, 2008 10:58 ]
Post subject:  Re: PHP help - integrating login with phpBB3

Cookie domain: server (the name of our server, obv)
Cookie path: /
Cookie name: phpbb3_2ryf3
Cookie secure: disabled

I've just logged into the forum. No cookies matching that name exist. I clear all cookies using Firefox, and my account stays logged in on the server.

I logout and login again, and the only cookie created has the name "style_cookie".

Author:  Doctor Glyndwr [ Thu Jul 24, 2008 11:03 ]
Post subject:  Re: PHP help - integrating login with phpBB3

GazChap wrote:
I've just logged into the forum. No cookies matching that name exist. I clear all cookies using Firefox, and my account stays logged in on the server.
Log into the site through Fiddlertool and take a long hard look at what cookies site is trying to set and their contents.

Author:  GazChap [ Thu Jul 24, 2008 11:08 ]
Post subject:  Re: PHP help - integrating login with phpBB3

Why didn't I think of that? I have LiveHTTPHeaders installed in Firefox, d'oh.

Anyway, it looks like it's trying to set the cookies:

Set-Cookie: phpbb3_2ryf3_u=56; expires=Fri, 24-Jul-2009 10:11:02 GMT; path=/; domain=server; HttpOnly
Set-Cookie: phpbb3_2ryf3_k=ff17156c5fdccda4; expires=Fri, 24-Jul-2009 10:11:02 GMT; path=/; domain=server; HttpOnly
Set-Cookie: phpbb3_2ryf3_sid=9aabab3ef132c1224f5d335bf670c152; expires=Fri, 24-Jul-2009 10:11:02 GMT; path=/; domain=server; HttpOnly

But then those cookies aren't present in any of the other headers, and they never get saved. It's an Apache server running on Windows 2000, wouldn't be an Apache security thing or anything would it?

Author:  Doctor Glyndwr [ Thu Jul 24, 2008 11:12 ]
Post subject:  Re: PHP help - integrating login with phpBB3

GazChap wrote:
But then those cookies aren't present in any of the other headers, and they never get saved.
Sounds like a client problem then, although I can't imagine why it would be broken. The cookies look right from what little I know of phpbb (the SID one is the important one I think). Grim...?

Author:  Grim... [ Thu Jul 24, 2008 11:27 ]
Post subject:  Re: PHP help - integrating login with phpBB3

Try setting the cookie domain to your full domain name, e.g. http://www.mysystem.tld, http://www.something.mydomain.tld. You must ensure the domain name contains at least two dots or browsers will be unlikely to recognise the cookie, e.g. .mydomain.com, mydomain.com. Do not add http:// or anything else.

Author:  Grim... [ Thu Jul 24, 2008 11:28 ]
Post subject:  Re: PHP help - integrating login with phpBB3

Gah - the board keeps adding http:// to those urls. Don't!

Author:  GazChap [ Thu Jul 24, 2008 11:49 ]
Post subject:  Re: PHP help - integrating login with phpBB3

Well, thats a fucker then. I can't add any dots into our server name and still have it work :P

Gonna have to upload it to a proper website and test from there then.

Author:  Cras [ Thu Jul 24, 2008 12:03 ]
Post subject:  Re: PHP help - integrating login with phpBB3

GazChap wrote:
Well, thats a fucker then. I can't add any dots into our server name and still have it work :P


Using the fully qualified DNS name should work, shouldn't it?

Author:  Doctor Glyndwr [ Thu Jul 24, 2008 12:05 ]
Post subject:  Re: PHP help - integrating login with phpBB3

Craster wrote:
GazChap wrote:
Well, thats a fucker then. I can't add any dots into our server name and still have it work :P


Using the fully qualified DNS name should work, shouldn't it?
Or a hosts file entry on the client machine. You could use any server name you want then. At least just for testing.

Author:  GazChap [ Thu Jul 24, 2008 12:08 ]
Post subject:  Re: PHP help - integrating login with phpBB3

It's not that, I just tried it with http://www.source-design.co.uk and it's still not saving the cookies.

//edit: without the http:// obv.

Author:  Grim... [ Thu Jul 24, 2008 12:10 ]
Post subject:  Re: PHP help - integrating login with phpBB3

Try .source-design.co.uk

Author:  GazChap [ Thu Jul 24, 2008 12:15 ]
Post subject:  Re: PHP help - integrating login with phpBB3

It's alright, I'd not changed the cookie settings in the admin panel, because I'm a fuckwit.

All works now. Mah-vellous. Cheers.

Page 1 of 1 All times are UTC [ DST ]
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group
http://www.phpbb.com/