Automatic login to phpBB from my site's login script

Discussion forum for MOD Writers regarding MOD Development.
gwales
Registered User
Posts: 6
Joined: Fri Feb 11, 2011 6:06 pm

Re: Automatic login to phpBB from my site's login script

Post by gwales »

Cookie path is set to /

Domain is set to domain.org

Forums exist at domain.org/forum

I am interpreting these as being correct?

Thanks for the help!

gwales
Registered User
Posts: 6
Joined: Fri Feb 11, 2011 6:06 pm

Re: Automatic login to phpBB from my site's login script

Post by gwales »

Resolved my issue.

By inspecting cookies I could see that the cookie existed in all browsers but the phpbb session cookie variables were not be added in certain IE (but for some IE users it was working).

As per this thread: http://www.phpbb.com/community/viewtopi ... &t=2104344

I deleted the Cookie Domain and the whole thing snapped into place.

manuelcr
Registered User
Posts: 3
Joined: Wed May 02, 2012 7:37 pm

Re: Automatic login to phpBB from my site's login script

Post by manuelcr »

Hi, I have used the Script of Noxwizard for my website.

I'm trying to validate my users from my website when they go to forum.

The script works fine, but when it redirects to the forum, the user appears as not logged (altough the session is created and the user/password validated).

I'm using phpBB 3 with this code:

Code: Select all

<?php
define('IN_PHPBB', true);
$phpbb_root_path = './';
$phpEx = substr(strrchr(__FILE__, '.'), 1);
include($phpbb_root_path . 'common.' . $phpEx);

// Start session management
$user->session_begin();
$auth->acl($user->data);
$user->setup();

if($user->data['is_registered'])
{
    //User is already logged in
}
else
{
    $username = request_var('userName', '', true);
    $password = request_var('password', '', true);

    echo "usuario: " . $username . " ; password: " . $password;
    $result = $auth->login($username, $password);

    if ($result['status'] == LOGIN_SUCCESS)
    {
        //User was successfully logged into phpBB
        echo "Login correcto";
        if ($ref !=""){
            header("location:$ref");
        }else{
            header("location:index.php");
        }
    }
    else
    {
        //User's login failed
        echo "Login incorrecto: " . $result['status'];
    }
}
?>
What do i have to do to show the user logged in phpBB?

Thanks.


UPDATE:

Hi, i have solved it. I changed the website url at 'Cookie Configuration' and it works now.

Thanks for all.

Dilip Pithiya
Registered User
Posts: 1
Joined: Wed Jul 25, 2012 5:32 am

Re: Automatic login to phpBB from my site's login script

Post by Dilip Pithiya »

I am using this script for admin login.And it is working. But, on next day i have to go with captcha and forum's re-authentication system. Once I get logged in using that system I can log in directly to forum admin from my site admin login.

Please help me.

Thanks

User avatar
Noxwizard
Support Team Leader
Support Team Leader
Posts: 10365
Joined: Mon Jun 27, 2005 8:41 pm
Location: Texas, USA
Name: Patrick Webster
Contact:

Re: Automatic login to phpBB from my site's login script

Post by Noxwizard »

Admin sessions do not live past the session length set in the ACP. Checking the "Remember me" box will not restore the admin session when you visit later, so you will have to re-authenticate to gain access to the admin panel.
[Support Template] - [Read Before Posting] - [phpBB Knowledge Base]
Do not contact me for private support, please share the question in our forums.

xanderPranav
Registered User
Posts: 1
Joined: Mon Mar 24, 2014 8:02 am

Re: Automatic login to phpBB from my site's login script

Post by xanderPranav »

Thanks Man... Your code helped me very much :D :D :D :D :D :D :D :D :D

Locked

Return to “[3.0.x] MOD Writers Discussion”