Gossamer Forum
Home : Products : Others : Gossamer Community :

How to detect if user is logged in?

Quote Reply
How to detect if user is logged in?
From a static page, what would be a good way to detect if a user is logged into Gcomm?
Quote Reply
Re: [Swaylock] How to detect if user is logged in? In reply to
From a static page? You could do some javascript to see if they have a cookie. It's not perfect as you won't be able to authenticate the cookie to make sure it's legit, but you could use it for cosmetic things (like displaying login/logout links, etc).

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] How to detect if user is logged in? In reply to
Thanks Alex,

Would/could there be any security issues with using javascript?

I was thinking perhaps a virtual cgi ssi.
Quote Reply
Re: [Swaylock] How to detect if user is logged in? In reply to
Hi,

I wouldn't do anything with javascript that needs to be secure, as you have no way of authenticating the session.

If you use SSI then it's not really a static page anymore. =) You could use SSI and do:

<!--#include virtual="/cgi-bin/community.cgi?do=ssi_login"-->

which will print user_ssi_login.html template with <%comm_username%> available if the user is logged in.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] How to detect if user is logged in? In reply to
Thanks -- I'm going to give it a go!