Registration and form validation is probably the most tedious part of creating a user authentication system - authentication is much asier, and can generally be accomplished with less than 20 lines of code.
As I usually recommend that passwords are stored as a hash, the way you find out if a user is valid, and has supplied the right password - you just need 1 SQL statement - if it returns values, then log the user in, if it doesn't - they dont have a valid acccount, or have not supplied the correct information.
Code:
SELECT * FROM users u
WHERE u.email LIKE '{$_POST[email]}'
AND u.password = MD5({$_POST[password]})
AND u.verified = '1'
To note a login, it's always easy to use a session.
Set $_SESSION['activeuser'] to your user record, then logging out is simply a matter of clearing the session item.
Regards