Moved common session and database logic to header.php.