Results 1 to 4 of 4

Thread: PHP Sessions

  1. #1

    Default PHP Sessions

    Ok im making a login script, and i want to apply sessions so other pages can sense wether the user is logged in. I can build a login without sessions (pointless), but when i apply them, it doesnt work.

    Here is my MySQL queries:

    $username = $HTTP_POST_VARS['name'];
    $password = md5($HTTP_POST_VARS['pass']);

    $result = mysql_query("SELECT COUNT(*) AS numfound FROM members WHERE username='$username' AND password='$password'");

    $result_ar = mysql_fetch_array($result);
    By using the code above, can anyone tell me how to store the users username in a session and see if there username is stored in the session?

    Ive used the session_start() and the session_register() but it doesnt intergrate with my login.

    Thanks! Encrypted!
    [IMG]http://www.****************/uploads/d854c54656.gif[/IMG]
    My Languages - PHP, HTML, Visual Basic, MySQL
    Learning - SQL, Ajax, XML

    Infractions - 0
    Reputation Comments: 1



  2. #2
    Join Date
    Aug 2004
    Location
    bristol
    Posts
    3,799
    Tokens
    0

    Latest Awards:

    Default

    You'll probably find it will be easier to look for a tutorial on sessions and one on MySQL.
    Last edited by nets; 04-09-2006 at 10:18 PM.
    kinda quit.

  3. #3
    Join Date
    Sep 2005
    Location
    East London
    Posts
    3,028
    Tokens
    0

    Latest Awards:

    Default

    Right... im a bit out of practice but i think it goes like this


    Code:
     
    $_SESSION['username'] = $username
    $_SESSION['password'] = $password
    However i am not POSSITIVE
    I doubt its right lol.. Worth a try though ey ;P

  4. #4

    Default

    Yeah ive tried that.
    Thanks anyway, think ive figured it.
    [IMG]http://www.****************/uploads/d854c54656.gif[/IMG]
    My Languages - PHP, HTML, Visual Basic, MySQL
    Learning - SQL, Ajax, XML

    Infractions - 0
    Reputation Comments: 1



Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •