Fixed redirection bug

Fixed a bug causing redirects after login to fail. Also changes all
‘require’ statements to ‘require_once’.