I can only seem to get the ID?
That is because you are only setting the id in the session.
$_SESSION['loggedin'] = true; $_SESSION['id'] = $row['user_id'];
To set the username in the session too, add the following after those lines
$_SESSION['username'] = $_POST['liusername']
Now you can display the users username by echoing $_SESSION['username'] variable
You will however want to sanitise and validate the $_POST data before using it in the query. Passwords should be hashed, not stored as plain text.
<?php print $GLOBALS['user']->name; ?>
globals of any sort should never be used. Wherever you have learnt that you should forget about it. What is the $user class?
it seems to end the session and logs me back out again.
Make sure you have started ( session_start() ) the session on any page that uses $_SESSIONS. Either that or you most likely a logic issue. It is hard to tell with the code you posted.Go to the full post