How to get a session variables. Need it for external script.

ClassiBase classifieds script Forums General help How to get a session variables. Need it for external script.

Tagged: ,

This topic contains 2 replies, has 2 voices, and was last updated by  ClassiBase 1 year, 1 month ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #3144 Reply

    Tom Chung
    Participant

    Hello,

    I am trying to build some extensions for my classibase and need some session variables to get transferred. (logged-in userid and eventuelly usename)

    Can you please tell me how to get it?

    It looks like classibase creates a session variables ‘id’, ‘username’, ’email’, ‘level’ in the script AuthUser.php and distroyes when the user logges out.

    I tried to catch those variables in themes/views …/ad.php like:

    echo ‘username:’.$_SESSION[self::SESSION_KEY][‘username’].”:”;

    When this attempt failed I tried to create a session variable directly:
    $_SESSION[‘useridlogged’]=AuthUser::$user->id;

    but both attempts failed. (Needles to say that I was logged in).

    Can you please help me by this?

    If I am not mistaken, I was using the second one with AuthUser::$user->id a while ago and it worked. But now it seams not working, or at least not working by me.

    Thanks.

    #3147 Reply

    Tom Chung
    Participant

    I was not quite right with

    $_SESSION[‘useridlogged’]=AuthUser::$user->id;

    not getting any value. It does. but not username, which is not that important. I can get it through database once I have id.

    But I rather have a session variables from a system, not having to add my own code and to know if the user is logged out. Otherwise I will have no clue if the user logged out unless I have to put some extra codes somewhere.

    thanks for help.

    • This reply was modified 1 year, 1 month ago by  Tom Chung.
    #3152 Reply

    ClassiBase
    Keymaster

    You can get username from session like this:

    $_SESSION[AuthUser::SESSION_KEY]['username']

    And other variables if you check this:

    print_r($_SESSION[AuthUser::SESSION_KEY]);

    • This reply was modified 1 year, 1 month ago by  ClassiBase.
Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: How to get a session variables. Need it for external script.
Your information: