Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 7 of 7

Thread: dual login help

  1. #1
    Regular Coder
    Join Date
    Feb 2005
    Posts
    663
    Thanks
    5
    Thanked 14 Times in 14 Posts

    dual login help

    I wish I new this stuff better..grrr, and hoping a friendly voice can give some guidance.

    I'm using phpbb as my forums, and I have the same users also registered in another separate gaming database.

    Currently the user has to to log into both phpbb and the game separately.

    Can someone maybe give me an example of how to have the user's log into both at the same time? I figure its just a matter of modifying the phpbb login script to also log the user into the game, but not sure about how to go about doing it.

    Can anyone help?

  • #2
    Regular Coder
    Join Date
    Feb 2005
    Posts
    663
    Thanks
    5
    Thanked 14 Times in 14 Posts
    ok. I'm trying to learn and teach myself as well. I see the games login form goes to:

    form action="includes/user_login.php

    So, I'm thinking I need to take the username and password info being passed from the phpbb login form to this file? Does that make sense? Is it possible to have a form perform 2 actions when the user hits submit?

  • #3
    teh Moderatorinator
    Join Date
    Sep 2004
    Location
    USA
    Posts
    2,472
    Thanks
    4
    Thanked 40 Times in 40 Posts
    Whichever form they fill out, open up that action page and add an additional insert to your other db. Of course you'll need to connect to it and all of that jazz.

    Good luck.

  • #4
    Regular Coder
    Join Date
    Feb 2005
    Posts
    663
    Thanks
    5
    Thanked 14 Times in 14 Posts
    Thanks for the help, and I'll begin to research it. But am I understanding correctly about the insert?

    The user is already registered in both databases with the same username and password. I just need to have the logged into both at the same time.

  • #5
    teh Moderatorinator
    Join Date
    Sep 2004
    Location
    USA
    Posts
    2,472
    Thanks
    4
    Thanked 40 Times in 40 Posts
    Woop! I'm sorry, I mis-read the first post.
    Yeah, if they are already registered in both you don't need to do an insert.

  • #6
    Regular Coder
    Join Date
    Feb 2005
    Posts
    663
    Thanks
    5
    Thanked 14 Times in 14 Posts
    Thanks, and I'm learning. From phpbb's site, I've learned to do the following thus far:

    PHP Code:
    define('IN_PHPBB'true);
    $phpbb_root_path './forums/'
    include(
    $phpbb_root_path 'extension.inc');
    include(
    $phpbb_root_path 'common.'.$phpEx); 

    //
    // Start session management
    //
    $userdata session_pagestart($user_ipGENERAL_MESSAGE);
    init_userprefs($userdata);
    //
    // End session management
    //

    if( $userdata['session_logged_in'] )
       {
                   echo(
    'You are logged via phpBB!!');
       }
    else
           {
                   echo(
    'Please Login');
           } 
    So the game is now saying I'm logged into phpbb. I just need to now get into pass the php username, etc to the game, so that your logged into the game at the same time. Slowly making progress.

  • #7
    Regular Coder
    Join Date
    Feb 2005
    Posts
    663
    Thanks
    5
    Thanked 14 Times in 14 Posts
    Not sure if I'm the right track or not, but I tried modifying the original game login script of this:

    PHP Code:
    // Get GET and POST variables
    $id $_POST['id'];
    $name $_POST['login'];
    $password md5($_POST['pass']); 
    to this:
    PHP Code:
    if( $userdata['session_logged_in'] )
       {
        
    sql "SELECT user_id, username, user_password, user_active, user_level, user_login_tries, user_last_login_try
        FROM " 
    USERS_TABLE "
        WHERE username = '" 
    str_replace("\\'""''"$username) . "'";
        
    $row $db->sql_fetchrow($result)
        
    $id $row[0];
        
    $name $row[1];
        
    $password $row[2];
       }
    else
           {
                   echo(
    'Please Login');
           }

    // Get GET and POST variables
    $id $row[0];
    $name $row[1];
    $password $row[2]; 


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •