Refactor MageServlet to support PHP standard session handling