Need some help with PHP/MySQL

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

  1. Wabsta
    OP

    Wabsta you fight like a dairy farmer

    Member
    2,498
    69
    Apr 25, 2008
    Netherlands
    SCUMM Bar
    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

    Cyan GBATemp's lurking knight

    Global Moderator
    17,413
    7,997
    Oct 27, 2002
    France
    Engine room, learning
    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

    Wabsta you fight like a dairy farmer

    Member
    2,498
    69
    Apr 25, 2008
    Netherlands
    SCUMM Bar
    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

    Cyan GBATemp's lurking knight

    Global Moderator
    17,413
    7,997
    Oct 27, 2002
    France
    Engine room, learning
    I'm glad you liked it [​IMG]

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

    Wabsta you fight like a dairy farmer

    Member
    2,498
    69
    Apr 25, 2008
    Netherlands
    SCUMM Bar
    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.