Results 1 to 4 of 4

Thread: phpBB: Check session (logged in user?)

  1. #1
    Join Date
    Aug 2007
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default phpBB: Check session (logged in user?)

    Where is code to check session (logged in user?) in whole of phpBB code?

    Can everyone show me? Thank you very much

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    I don't know how phpBB works.
    Just check the database and/or session variables and see if they verify with the database records.
    http://php-mysq-tutorial.com will give you all of the commands needed.
    However, to use this, you'll need to figure out how phpBB stores this. I'd suggest asking at a phpBB support forum, where they know this.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    May 2006
    Location
    Sydney, Australia - Near the coast.
    Posts
    1,995
    Thanks
    0
    Thanked 8 Times in 7 Posts

    Default

    It could be $_SESSION['user'] but that's just a guess.
    Peter - alotofstuffhere[dot]com - Email Me - Donate via PayPal - Got spare hardware? Donate 'em to me :) Just send me a PM.
    Currently: enjoying the early holidays :)
    Read before posting: FAQ | What you CAN'T do with JavaScript | Form Rules | Thread Title Naming Guide

  4. #4
    Join Date
    Aug 2007
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Ok man, i just found your post on google(don't you just love google?! lol) because i was trying to do the same thing as you and i was searching for answers. I found them myself several minutes later but i just thought i should help you, in case you still haven't figured it out (or anyone else for that matter).

    So, the code for checking if a user is logged in or not is found in the sessions.php(phpbb/includes/sessions.php) file, there you will find several functions that deal with, well sessions. The function you'll want to look at is called "session_begin". Scroll to the end of that function and you'll see that there is an array called '$userdata', now you can check if a user is logged in or not just by checking the value of $userdata['session_logged_in']. There is also alot more useful information about the user in that array.

    Another way would be to examin these 2 lines:
    Code:
    	setcookie($cookiename . '_data', serialize($sessiondata), $current_time + 31536000, $cookiepath, $cookiedomain, $cookiesecure);
    	setcookie($cookiename . '_sid', $session_id, 0, $cookiepath, $cookiedomain, $cookiesecure);
    You can check the cookies to see if user is logged in or not too i believe.

    In addition, you might find it useful to look at the login.php to help you log the user into your forum.

    Hope that helped, good luck!

Bookmarks

Posting Permissions

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