Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

PHP+MYSQL headache

Options
  • 10-03-2007 3:22am
    #1
    Registered Users Posts: 8,070 ✭✭✭


    i have 2 files.
    register.php and login.php

    LOGIN.PHP
    [PHP]
    $username = mysql_real_escape_string($_POST["username"]);
    $password = mysql_real_escape_string(md5($_POST));

    $query = "SELECT * FROM user WHERE username = '$username' AND password = '$password'";

    $result = mysql_fetch_array(mysql_query($query));


    [/PHP]


    NOW i wanna make another one lets say reg2.php
    which will update the table with the score for the logged in person !
    i cant just do where username = $username etc because all this file will be taking in will be the score [for example from a textfeild]

    will i have to do this within login?
    if so how?

    anyone give me simple session example using my code?

    thank you


Comments

  • Registered Users Posts: 8,070 ✭✭✭Placebo


    never mind, got it

    stored username in session
    [PHP]
    $_SESSION = $username;
    [/PHP]

    called it another file
    [PHP]
    $newChecker = $_SESSION;
    [/PHP]


  • Registered Users Posts: 3,594 ✭✭✭forbairt


    Hmm ... wouldn't it be better to get the session ID ... in reg2 ... and from this do a look up of the logged in user against your user session table in your database ?


Advertisement