Session and login redirecting

prevented certain pages if not logged in (upload)
login redirects to home or to the page the user tried to access while
not logged in
Logout redirects to home page