Move check session to layout.phtml and moved message box to this same file.