Accessing information from session and cookie.

Discussion in 'Integration' started by frobark, Sep 23, 2014.

  1. frobark

    frobark New Member

    Joined:
    Jan 11, 2012
    Messages:
    3
    Hi,

    I want to integrate amember with some php scripts and I have a couple of questions.

    I can use the protection includes to send people back to login, but I would like to piggy back onto the amember user data, as my scripts have no user management themselves.

    The main thing I would like to know is the recommended method for getting the user id of the currently logged in user. Once I have the user id I can take care of everything else.

    Can I pull it from the cookie directly? Or do I need to match it via the session table?

    Thanks.
  2. thehpmc

    thehpmc aMember Pro Customer

    Joined:
    Aug 24, 2006
    Messages:
    901
    Neither.

    Simplest way is include
    as first line of your php page and then to include username on page is
    or to make it its own variable
    Many other options here - http://www.amember.com/docs/API/Lite
  3. frobark

    frobark New Member

    Joined:
    Jan 11, 2012
    Messages:
    3
    perfect!

    That is what I was hoping for. I was writing a lot of this myself and figured there must be some easier way and it appears there is.

    Thanks a heap.

Share This Page