Hello username not displaying

Discussion in 'Integration' started by dchs12, Mar 30, 2008.

  1. dchs12

    dchs12 New Member

    Joined:
    Mar 16, 2008
    Messages:
    3
    I'm using the following code on my home page:

    <?php
    if ($au=$_SESSION['_amember_user']){ // user is logged-in
    print "Hello $au[name_f] $au[name_l]!<br>";
    print "<form method=post action='/amember/logout.php'>
    <input type=submit value='Logout'>
    </form>";
    } else { // user is not logged-in
    print "<form method=post action='/amember/login.php'>
    Username: <input type=text name=amember_login size=10><br>
    Password: <input type=password name=amember_pass size=10><br>
    <input type=submit value='Login'>
    </form>";
    }
    ?>

    The login works but when the user returns to the home page they don't see Hello User with a logout button.

    What am I missing?

    Thanks!
  2. skippybosco

    skippybosco CGI-Central Partner Staff Member

    Joined:
    Aug 22, 2006
    Messages:
    2,526
    I'm guessing you need to add:

    Code:
    session_start();
    somewhere near the top of your page..

Share This Page