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 10 of 10
  1. #1
    Regular Coder
    Join Date
    Feb 2010
    Posts
    209
    Thanks
    15
    Thanked 2 Times in 2 Posts

    phpBB forum sessions

    Hi,

    I have phpBB forum and want to create a session from page which is in my website... I know that I need a special form, but I have no idea where to send values of password and login when someone tries to login...

    Do someone had this kind of problem before? If you haven't understood what I am seeking for - ask me

    The main idea is to make login page which would create a session in my forum, because my page with form is outside the phpBB forum directory.

    Thanks in advance

  • #2
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,546
    Thanks
    8
    Thanked 1,094 Times in 1,085 Posts
    At the very top of your "protected" page, put the code shown ...
    make sure the root_path variable points to where your forum is located.
    In the example, my forum is located in another directory called "forum".
    Your path will probably be different from mine.

    PHP Code:
    <?php
    session_start
    ();
    define('IN_PHPBB'true);
    $phpbb_root_path '/forum/';
    $phpEx substr(strrchr(__FILE__'.'), 1);
    include(
    $phpbb_root_path 'common.' $phpEx);

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

    ?>

    .
    . Then the rest of your HTML page
    .
    .
    .
    . You can also display the user's login name within your HTML, if you want ... like this ...
    .
    <?php
    if($user->data['is_registered']){
    echo(
    '<span style="font-size:13pt; font-weight:bold; color:#d31044;">Welcome Back '.$user->data['username'].'! </span> &nbsp; | &nbsp; <a href="' append_sid("{$phpbb_root_path}ucp.$phpEx"'mode=logout'true$user->session_id). '" class="textlink">Log out</a>');
    echo
    "<br />";
    include(
    $page);
    }
    else
    {
    ?>
    .
    .
    .
    . The rest of your HTML
    .
    .

  • #3
    Regular Coder
    Join Date
    Feb 2010
    Posts
    209
    Thanks
    15
    Thanked 2 Times in 2 Posts
    can you tell me, which variables of this script are pass and login??

    Because I want to create phpBB forum session and mine too by using same info
    Last edited by auriaks; 03-15-2010 at 06:52 PM.

  • #4
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,546
    Thanks
    8
    Thanked 1,094 Times in 1,085 Posts
    That example is what sessions are created when you log into phpBB.
    There are no session variables for the password, only the username.

    That's sort of the point of using sessions. Once a person is logged-in, you
    don't care about the password anymore ... they are logged in.

    So on your site, you'll have them log into phpBB, and then you can leave
    the forum and use the same session variables on other pages. But they
    have to log into phpBB first, using the phpBB login form.

    I guess I don't understand what you're trying to do exactly?

  • #5
    Regular Coder
    Join Date
    Feb 2010
    Posts
    209
    Thanks
    15
    Thanked 2 Times in 2 Posts
    what you are saying is right

    I can try to explain this again:

    I have my site with sessions like this:

    PHP Code:
    session_start();
          
    $_SESSION['nick'] = $nick;
          
    $_SESSION['password'] = $password;
          
    $_SESSION['authID'] = $r['id']; 
    $password - md5 type.
    $nick - lowercase letters
    $id - number.

    What I want to do is to create MY session and phpBB session at the same time from the same LOGIN FORM. I don't want to use phpBB sessions in my entire webpage because I have saved other, different info which I use.

    Password and login are the same and that lets me to create two sessions at the same time.

  • #6
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,546
    Thanks
    8
    Thanked 1,094 Times in 1,085 Posts
    I think phpBB encrypts their passwords (MD5), so you would not
    be able to work with that anyhow.

    So, which way are you going?
    1) Have them log into phpBB and use that throughout?
    2) Have them log into your regular site and use that with phpBB ... throughout?

    Which login will be the "master" login?

  • #7
    Regular Coder
    Join Date
    Feb 2010
    Posts
    209
    Thanks
    15
    Thanked 2 Times in 2 Posts
    This one: Have them log into your regular site and use that with phpBB.

    I am using md5 too. Apart from this, user enters their real ligin and pass, and then pass is encrypted via md5. So if they put real values, I can check them.

    When user logs theese steps would be executed:

    1. user enters login and pass
    2. Then php script checks if that login and pass are in MY database.
    3. Then phpBB php script checks if that login and pass are in its database.
    4. If the entered information exists in both databases, MY session and phpBB session will be activated, otherwise - error message.

    The hard thing is to make a script which would check this info and create both sessions.

  • #8
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,546
    Thanks
    8
    Thanked 1,094 Times in 1,085 Posts
    phpbb uses an authorization plugin that can be changed to whatever you want.
    This is really advanced, out of my league. Here is a PHP Class for it.
    www.phpclasses.org/browse/package/1532.html

    You might want to look for a phpbb forum for more advanced help.
    But I know it can be done. phpbb can use YOUR custom site login instead of it's own.

  • #9
    Regular Coder
    Join Date
    Feb 2010
    Posts
    209
    Thanks
    15
    Thanked 2 Times in 2 Posts
    Can you write me a form and php script which creates phpBB session??

  • #10
    Master Coder
    Join Date
    Jun 2003
    Location
    Cottage Grove, Minnesota
    Posts
    9,546
    Thanks
    8
    Thanked 1,094 Times in 1,085 Posts
    Quote from post #8:
    Quote Originally Posted by mlseim View Post
    This is really advanced, out of my league.


  •  

    Posting Permissions

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