Gossamer Forum
Home : Products : Gossamer Links : Discussions :

letting visitors know if they're logged in?

Quote Reply
letting visitors know if they're logged in?
hello,

does anyone know if there's a <%tag%> that i can stick in the menu bar of my page, that will tell the vistor a little msg like:

"you are not logged in"

and then when they log in, there will be a little msg in the menu that says:

"welcome (and their username)"

thanx,

eddie

Last edited by:

eddie123: Feb 6, 2003, 1:13 PM
Quote Reply
Re: [eddie123] letting visitors know if they're logged in? In reply to
Try something like;

<%if Username%>
Hi <%Username%>, welcome back!
<%else%>
You are not logged in.
<%endif%>

I'm not definate if its the 'Username' tag. If that one doesn't work, then do a <%GT::Template::dump%> and see what tag holds the username....

BTW: You will obviously need to be running in dynamic mode for the script to work out if they are logged in or not Smile

Cheers

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [eddie123] letting visitors know if they're logged in? In reply to
As long as the page your using it on is dynamic you can do something like this...

<%if Username%>
Welcome, <%Username%>
<%else%>
Hello Guest, you are not logged in.
<%endif%>

or

<%if Contact_Name%>
Welcome, <%Contact_Name%>
<%else if Username%>
Welcome, <%Username%>
<%else%>
Hello Guest, you are not logged in.
<%endif%>


Hope that helps!
Quote Reply
Re: [Andy] letting visitors know if they're logged in? In reply to
beat me to it Andy! Tongue
Quote Reply
Re: [eddie123] letting visitors know if they're logged in? In reply to
I use a global. It only works in dynamic mode, but here it is:

--> login_check
Code:
sub {
my $tags = shift;
my $username = $tags->{Username};
my $login = '';
if ($username){
$login = '<a class="menulink" href="/bin/user.cgi?logout=1&d=1">Logout</a>';
}else{
$login = '<a class="menulink" href="/bin/user.cgi?d=1">Login</a>';
}
return $login;
}

In your template, just put <%login_check%> wherever you want the login link.

Sean
Quote Reply
Re: [Jonze] letting visitors know if they're logged in? In reply to
In Reply To:
beat me to it Andy! Tongue

LOL Laugh

Andy (mod)
andy@ultranerds.co.uk
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package | GLinks ULTRA Package PRO
Links SQL Plugins | Website Design and SEO | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Quote Reply
Re: [Andy] letting visitors know if they're logged in? In reply to
I agree... You're pretty quick. Laugh

Sean
Quote Reply
Re: [SeanP] letting visitors know if they're logged in? In reply to
Maybe ...

http://gossamer-threads.com/...orum.cgi?post=196193