Help with PHP login script recognizing users.

Discussion in 'PHP' started by Toya-Chan, Mar 12, 2011.

  1. #1
    Okay so I posted about this in a similar topic but I don't think they got what I wanted because the script didn't work at all.

    I have an existing login script. It works with three pages: login, members, logout. There is a register page also but it is not related to the issue.

    The script provided is supposed to display the name of the logged in user in two instances:

    1) when you log in it is supposed to tell you "You are now logged in *username here*! Continue to the members section(this would have been the link to members page)."

    2) when on the member's page, it is supposed to display "You are logged in as *username*. Welcome *username*. Log out "

    ... but both pages do not display the names. There are three users.

    Can someone tell me why this script doesn't display usernames and how I can fix it, exactly, as I am a noob with php and have no idea how to get it done.

    The table created is called user, it has three rows: ID, username, and password

    ================================================================

    Login


    ================================================================

    Members

    ================================================================

    Logout

     
    Toya-Chan, Mar 12, 2011 IP
  2. jwitt98

    jwitt98 Peon

    Messages:
    145
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You're trying to create a cookie with the $username variable, but I don't see where the $username variable is being set. Try adding this before your cookie code:
    $username = $_POST['username'];
    PHP:
     
    jwitt98, Mar 12, 2011 IP
  3. Toya-Chan

    Toya-Chan Peon

    Messages:
    9
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    I love you. Can I have your babies?

    Also known as it works. :)
     
    Toya-Chan, Mar 13, 2011 IP
  4. jwitt98

    jwitt98 Peon

    Messages:
    145
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Lol. yes but only one.
     
    jwitt98, Mar 13, 2011 IP