Changed loggedin and email cookies to sessions

Basically made user sign in more secure as the client can't modify
sessions.
Also made it so users are now automatically linked to the users_topics
table.
A bunch of other small fixes for linked pages.