Implemented session handling.

Most changes occured in session.php where there is now a Session object that is used as a more friendly interface with PHP native sessions. the Api changed to reflect this new object. Session has **not** been integrated throughout the whole site.