Couple of quick pointers:
Don't use "SELECT * " - list out only the columns you require.
What is the reason for putting the session_id in the querystring? Why not store it in a session variable instead i.e. somewhere the user can't see.
In fact, why store it at all? If you need it at all you can just grab is using the session_id() function.
So instead use session variables to store something to show the user is authenticated or not.
PHP Sessions
Another thing I spotted is this line:
Code:
$user = $_POST['username'];
I think it would be best to populate your $user variable from your initial SELECT statement.
Also, why have you escaped your variables in the first SQL statement and not the second? Any reason not to do it in the second?
Hope this helps
