Topic: Increased Security and Code Optimization
For logins, I like how you've switched to SHA1, however you still don't use salts. Hackers have pre-generated lists of SHA1 encoded words. If you used salts, they'd have to regenerate their entire list to crack just one password.
Salt basically works on this principle:
user's password: password
user's password + salt: password51MmfJzkfL5
sha1: sha1(password51MmfJzkfL5)
password stored in DB: (sha1)51MmfJzkfL5
So when they login, the server grabs the last # chars (your salt), appends it to the submitted password, generates the SHA1, and compares.
Also, reviewing your code you do this many times:
<?php echo $var ?>
This is the shorthand version and may save some keystrokes in the future:
<?=$var ?>
This performs the exact same echo.