Fix a number of PHP notice errors

Caused by accessing undefined index REMOTE_USER.
Don't initialize session if already started

Failure to do this causes a PHP notice error, which can happen e.g. if a
plugin starts a session.