Code example to set amember login cookie with php?

Discussion in 'Integration' started by saltdog, Oct 10, 2009.

  1. saltdog

    saltdog New Member

    Joined:
    Sep 4, 2008
    Messages:
    6
    How can I use PHP setcookie() so when users register from a custom register system, the amember system will recognized them as logged i
  2. saltdog

    saltdog New Member

    Joined:
    Sep 4, 2008
    Messages:
    6
    bump

    10chars
  3. skippybosco

    skippybosco CGI-Central Partner Staff Member

    Joined:
    Aug 22, 2006
    Messages:
    2,526
    @saltdog: I'm assuming the userid and password are the same in your 3rd party app that is in aMember? If that is the case than you just set the (from memory here)

    $_SESSION['_amember_login']
    $_SESSION['_amember_pass']

    You can take a look at your session tables on a logged in site to be for sure.

    Note: This will not trigger any 3rd party integration hooks I believe.. so not sure how useful this will be. What is your use case?
  4. saltdog

    saltdog New Member

    Joined:
    Sep 4, 2008
    Messages:
    6
    I have written my own script to register users (using the correct data). However, I need to have them be automatically logged in when they register
  5. alexander

    alexander Administrator Staff Member

    Joined:
    Jan 8, 2003
    Messages:
    6,279
    To make this happen you need to set two session variables in your script:
    Code:
            $_SESSION['_amember_login']     = "USERLOGIN";
            $_SESSION['_amember_pass']      = "USERPASSWORD";
    

Share This Page