Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Not preserving login state

Quote Reply
Not preserving login state
Here's a tricky one I haven't been able to solve.

1. If you go to directory.edvisors.com, create an account, and log in, your login state shows that you're logged in, and the menus change appropriately.

2. If you then surf any of our listings, you lose the login state and in order to add/change a link, you have to relogin.

3. Here's the weird part - if you go into dynamic mode, state is preserved no matter what.

I'm not sure how to repair this and didn't see anything in a quick forum search - anyone seen this before?
Quote Reply
Re: [cspenn] Not preserving login state In reply to
Hi,

What do you have set in Setup > User Optiuons > user_cookie_domain

?

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: [Andy] Not preserving login state In reply to
It's... umm... blank... hmm.
Quote Reply
Re: [cspenn] Not preserving login state In reply to
I put directory.edvisors.com in - do I need to do a full build now?
Quote Reply
Re: [cspenn] Not preserving login state In reply to
Try .edvisors.com (the . at the beginning is important, as that tells the cookie to work on www, and any sub-domain)

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: [Andy] Not preserving login state In reply to
Added, running build all now.
Quote Reply
Re: [cspenn] Not preserving login state In reply to
Still no luck - loses state except in dynamic mode, even with cookies set.
Quote Reply
Re: [cspenn] Not preserving login state In reply to
Hi,

Looks like you don't have the Javascript in your page to do it :P

Code:
<script type="text/javascript">
//<![CDATA[
registerEvent(window, 'onload', function () {
var loginbar = document.getElementById('loginbar');
if (!loginbar)
return;
var loginlink = loginbar.firstChild;
if (loginlink.className != 'out')
return;
var cookies = document.cookie.split(';');
for (var i = 0; i <cookies.length; i++) {
if (cookies[i].match(/^\s*s=[0-9a-f]{32}\s*$/)) {
loginlink.href = '<%config.db_cgi_url%>/user.cgi?logout=1';
loginlink.className = 'in';
loginlink.firstChild.nodeValue = 'Logout';
break;
}
}
});
//]]>
</script>


this requires you to have a div like this for it to change over correctly:

<div id="loginbar"><a href="<%config.db_cgi_url%>/user.cgi" class="out">Login/Register</a></div>

hope that helps.

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: [Andy] Not preserving login state In reply to
Hm, I thought I could do it server side, e.g.:

<%if Username%>
<p><a href="http://directory.edvisors.com/cgi/add.cgi">Add a Link</a></p>
<p><a href="http://directory.edvisors.com/cgi/modify.cgi">Modify a Link</a></p>
<p><a href="http://directory.edvisors.com/cgi/user_modify.cgi">Manage your profile</a></p>
<p><a href="http://directory.edvisors.com/cgi/bookmark.cgi">Manage your bookmarks</a></p>
<p><a href="http://directory.edvisors.com/cgi/user.cgi?logout=1">Logout</a></p>
<%endif%>

<%ifnot Username%>
<p><a href="http://directory.edvisors.com/cgi/user.cgi">Login/Register</a></p>
<%endif%>

This won't work?
Quote Reply
Re: [cspenn] Not preserving login state In reply to
Not with static - only when using mod_rewrite.

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: [Andy] Not preserving login state In reply to
Could you link me to a tutorial for setting this up w/static and mod_rewrite? Thanks!
Quote Reply
Re: [cspenn] Not preserving login state In reply to
Hi,

Just had a look (search for "mod_rewrite" in the GLinks forums), but couldn't find a definative way of doing it. We do offer this service (click on our site, and goto "Services", the link is there - but its paid-for)

Sorry I can't be of more help -mod_rewrite can be a bugger to setup on some server (different ways of interpreting it, etc)

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: [Andy] Not preserving login state In reply to
Hey Andy,

It seems to be working on Web Hosting Kit & I am not even using JS - however I am using user_cookie_domain option.

Vishal
-------------------------------------------------------

Last edited by:

SWDevil.Com: Jun 18, 2009, 9:08 PM
Quote Reply
Re: [SWDevil.Com] Not preserving login state In reply to
If you are using dynamic (mod_rewrite), it will be fine - but if not, then you MUST have the javascript that changes it form "Login" to "Logout" Wink

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: [Andy] Not preserving login state In reply to
You are right, as I am displaying Logout mainly on user.cgi page, it tend to work for both with dynamic and static view.

Vishal
-------------------------------------------------------