Need some help with PHP/MySQL

Discussion in 'Computer Programming, Emulation, and Game Modding' started by Wabsta, Nov 11, 2008.

Nov 11, 2008

Need some help with PHP/MySQL by Wabsta at 6:31 PM (919 Views / 0 Likes) 4 replies

  1. Wabsta
    OP

    Member Wabsta you fight like a dairy farmer

    Joined:
    Apr 25, 2008
    Messages:
    2,485
    Location:
    SCUMM Bar
    Country:
    Netherlands
    Okay, I managed to make a login, and a register script (it's for a school project btw).
    But, it has to check if someone really logged in.

    I've read something about sessions, but I didn't really get it.

    So, can someone explain these Sessions to me?
     
  2. Cyan

    Global Moderator Cyan GBATemp's lurking knight

    Joined:
    Oct 27, 2002
    Messages:
    16,437
    Location:
    Engine room, learning
    Country:
    France
    session is like temporary informations on the userside, which are deleted when the user close its explorer or tab window.


    to read those data, you need to initialize (allow PHP to access) the sessions on each page you need it with a session_start()

    CODE
     
  3. Wabsta
    OP

    Member Wabsta you fight like a dairy farmer

    Joined:
    Apr 25, 2008
    Messages:
    2,485
    Location:
    SCUMM Bar
    Country:
    Netherlands
    Wow, thanks, that was better than all those tutorials on the interwebs.

    Because I finally get it now.
    So, thanks, I'll try it tommorow morning in class [​IMG]
     
  4. Cyan

    Global Moderator Cyan GBATemp's lurking knight

    Joined:
    Oct 27, 2002
    Messages:
    16,437
    Location:
    Engine room, learning
    Country:
    France
    I'm glad you liked it [​IMG]

    I hope your project will be successful.
    Let me know [​IMG]
     
  5. Wabsta
    OP

    Member Wabsta you fight like a dairy farmer

    Joined:
    Apr 25, 2008
    Messages:
    2,485
    Location:
    SCUMM Bar
    Country:
    Netherlands
    Okay, I have this code now, but it doesn't work.
    It's based on your idea Cyan.
    Here it is:
    CODE

    It kinda works, as it makes me go to the site I inteded to go to (home.php, in home.php, there was a require "auth.php" which is this file), but if I go there again, it just gives me the login section again...
    So probably, the session doesn't work.

    Some information:
    naam=name
    wachtwoord=pass
    verzonden=submit

    These are some dutch words, that you may not figure out what it is [​IMG]

    EDIT: I think it works now:
    CODE

    But how do I logout now?
    I don't really get it..

    EDIT 2:
    NVM, figured it out.
     

Share This Page