Forums / All Other Contributions/Addons / Is a Permanent Login (Auto-Login) Possible?

Is a Permanent Login (Auto-Login) Possible?

Views: 54,687

Results 41 to 60 of 219
24 Apr 2007, 12:30 AM
#41
hareslade avatar

hareslade

Totally Zenned

Join Date:
Nov 2004
Location:
U.K. South Wales
Posts:
442
Plugin Contributions:
0

Is a Permanent Login (Auto-Login) Possible?

I'm still writing my w.i.p essay here..bear with me..

Have a look at
http://uk.php.net/setcookie
Whether you know php or not, you'll see references low on the page, to the ways different browsers analyze domain names when deciding whether to store a cookie, which in this case is the thing that enables auto logon. There is a vital parameter in the cookie called the domain path.

One prob I have fully examined tonight, is how to get auto login using a domain without the 'www.' in front. Most servers accept 'domain.com' as well as https://www.domain.com.

One of zencarts quirks is that if the domain gets set to 'domain.com' in the config file, all the pages in zencart have that in the url. This can happen I think when you install, if you initially access your zencart install folder without the www. in front.

But looking at the page quoted above, IE6 especially, it seems that IE6 refuses to store a cookie if there's not two dots in the domain name, if its a dot com. So anyone without the 'www.' in front in the config file, won't ever save a cookie in IE6, for auto logon?

But this isn't the end of the story, as I found out. My IE6 bookmark for my site home page has no www. in front. I proved that when this url is used, the cookie -even if saved properly previously using the contrib's login page with a full https://www.domain.com, -- the cookie is not read out by IE6 with a page url that has no www. in front. i.e no auto logon.

'for me' IE 6.0.28 sp1, on win 2000 sp2, does not cough up the 'zencart_cookie_permlogin' cookie previously saved by a 'www.doman.com' page log in (ticked checkbox), if the page url in the browser address bar now has 'domain.com'. Coders can check that out by putting 'echo the cookie value' in php code, near the top of the index page header.

So... woe betide any zencart user that enters the site url without the www. in front, he'll have to manually log on?

I have to be away soon..so can't really go much further at present with this. But it almost seems that cookies for auto logon are a difficult challenge, whereas as far as I know, the only cookie zencart uses is 'zenid', and possibly with a 'non-www.' domain if cookies fail then the server can revert to session variables for zenid, so it doesn't matter...

So the basic problem is, if i'm correct, with certain browsers being awkward about when they will save a cookie, or cough it back up, with the non-www. url page domain base, (or cookie domain) I don't see quite how to ensure auto logon works regardless.

One way would be to redirect any page without www. to the same page with www. in front?

This is not a critique, but if I'm right it needs some mods..

24 Apr 2007, 7:25 PM
#42
hareslade avatar

hareslade

Totally Zenned

Join Date:
Nov 2004
Location:
U.K. South Wales
Posts:
442
Plugin Contributions:
0

Re: Is a Permanent Login (Auto-Login) Possible?

..still enmeshed.....and here's a mod
this is the gobbledegook text from that cookies discussion page I quoted a while back which applies to us unfortunates using .com domains for our zencart,

'Only hosts within the specified domain can set a cookie for a domain and domains must have at least two (2) or three (3) periods in them to prevent domains of the form: ".com", ".edu", and "va.us". Any domain that fails [sic] within one of the seven special top level domains listed below only require two periods. Any other domain requires at least three. The seven special top level domains are: "COM", "EDU", "NET", "ORG", "GOV", "MIL", and "INT".'

To avoid the existing auto logon cookie not being saved, or not read later by the browser, because your .com domain without www. has only one dot, but it wants two.......

as I said, this happens if the user accesses any cart page without the 'www.' in front of the domain name in the url,

this javascript code puts the www. back in front:

var URL;
URL = window.location.href;
if(URL.indexOf("www.") < 0){
window.location.href = URL.replace("://","://www.");
} 

To implement this, with dreamweaver or another linux cr/lf editor, put that code into a file called
'jscript_autologin.js'
and save it.

OR get it off my site in zip form
http://www.hareslade.com/zc125/downloads/jscript_autologin.zip
Upload the file into your \jscript folder of your current (or default) template.

I'm not sure whether a .co.uk domain for instance also needs a www. to make the cookie available. As already stated, it appears that if the domain url does not have the www., IE6 especially, fails to give the cookie when the autologin text wants to get it, because the browser says a requesting .com domain without a www. is unnacceptable.

The above is a non-invasive mod you can add into the auto login contrib.

.coms people and others in the list will notice the home page now comes up correctly as auto logged in, provided of course the log on page was set to auto in the tickbox choice and the cookie was saved.

My javascript knowledge is not immense, but the code seems to work, you see the url change abruptly in the address bar when a non-www. url is used.

24 Apr 2007, 7:42 PM
#43
hareslade avatar

hareslade

Totally Zenned

Join Date:
Nov 2004
Location:
U.K. South Wales
Posts:
442
Plugin Contributions:
0

Re: Is a Permanent Login (Auto-Login) Possible?

..and my final comment is, is obvious but I didn't realise..

If you activate auto login with say IE6, then start using opera instead, you have to do a 'activate auto login' with Opera freshly, because browsers don't use each other's cookies.

That may be why some people think the contrib doesn't work proper..

29 Apr 2007, 2:40 AM
#44
gxjenkins avatar

gxjenkins

Zen Follower

Join Date:
Apr 2007
Location:
Tampa, Florida
Posts:
180
Plugin Contributions:
0

Re: Is a Permanent Login (Auto-Login) Possible?

Hello,
Just installed the Auto Login Mod, and I'm getting the following error at the top of the page. I'd like to find a fix rather than uninstall so any help would be appreciated.

"module_directory('require_languages.php')); // set the product filters according to selected product type $typefilter = 'default'; if (isset($_GET['typefilter'])) $typefilter = $_GET['typefilter']; require(DIR_WS_INCLUDES . zen_get_index_filters_directory($typefilter . '_filter.php')); // query the database based on the selected filters $listing = $db->Execute($listing_sql); // if only one product in this category, go directly to the product page, instead of displaying a link to just one item: // if filter_id exists the 1 product redirect is ignored if (SKIP_SINGLE_PRODUCT_CATEGORIES=='True' and (!isset($_GET['filter_id']) and !isset($_GET['alpha_filter']))) { if ($listing->RecordCount() == 1) { zen_redirect(zen_href_link(zen_get_info_page($listing->fields['products_id']), ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing->fields['products_id'])); } } // This should be last line of the script: $zco_notifier->notify('NOTIFY_HEADER_END_INDEX'); ?>"

Thanks

Gary Jenkins
Your Neighborhood Store
It Ain't Over Until You Quit, So Don't!

20 May 2007, 9:34 PM
#45
hareslade avatar

hareslade

Totally Zenned

Join Date:
Nov 2004
Location:
U.K. South Wales
Posts:
442
Plugin Contributions:
0

Re: Is a Permanent Login (Auto-Login) Possible?

autologin revisited..
I think the log out page is not always working, the cookie is not being deleted.

This can be tested by initialising autologon, convince yourself it works.

Then log off, close the browser, (and all other browser windows of the same browser), then come back to the cart home page with the same browser.

If the cookie really was deleted, you'll be asked to log on when you return.
If it logs you on then obviously the cookie is still existing.

I reckon the cookie set code in logoff\header_php.php is incomplete, see below.
Without a path set to same path (/) as the original cookie, I can see why a logoff might not destroy the cookie.

Certainly only the modified code seems to correctly work in firefox.

Existing code was similar to:
setcookie("zencart_cookie_permlogin", "expired", time() - 3600);
Modify to:
setcookie("zencart_cookie_permlogin", "expired", time() - 3600, '/', $current_domain);
12 Jun 2007, 1:58 PM
#46
crazy_chris avatar

crazy_chris

New Zenner

Join Date:
Feb 2007
Location:
Vienna
Posts:
38
Plugin Contributions:
0

Re: Is a Permanent Login (Auto-Login) Possible?

gxjenkins:

Hello,
Just installed the Auto Login Mod, and I'm getting the following error at the top of the page. I'd like to find a fix rather than uninstall so any help would be appreciated.

"module_directory('require_languages.php')); // set the product filters according to selected product type $typefilter = 'default'; if (isset($_GET['typefilter'])) $typefilter = $_GET['typefilter']; require(DIR_WS_INCLUDES . zen_get_index_filters_directory($typefilter . '_filter.php')); // query the database based on the selected filters $listing = $db->Execute($listing_sql); // if only one product in this category, go directly to the product page, instead of displaying a link to just one item: // if filter_id exists the 1 product redirect is ignored if (SKIP_SINGLE_PRODUCT_CATEGORIES=='True' and (!isset($_GET['filter_id']) and !isset($_GET['alpha_filter']))) { if ($listing->RecordCount() == 1) { zen_redirect(zen_href_link(zen_get_info_page($listing->fields['products_id']), ($cPath ? 'cPath=' . $cPath . '&' : '') . 'products_id=' . $listing->fields['products_id'])); } } // This should be last line of the script: $zco_notifier->notify('NOTIFY_HEADER_END_INDEX'); ?>"

Thanks

well, seems it spits out the code as html.
check if you forgot the opening php tags <?php in front of the code.

16 Jun 2007, 8:08 PM
#47
studeo avatar

studeo

Zen Follower

Join Date:
Jan 2007
Posts:
198
Plugin Contributions:
0

Re: Is a Permanent Login (Auto-Login) Possible?

The mod does NOT keep me logged in as promised. Im IE7 and all files have been processed correctly.

https://www.theribbondiva.com

16 Jun 2007, 9:55 PM
#48
hareslade avatar

hareslade

Totally Zenned

Join Date:
Nov 2004
Location:
U.K. South Wales
Posts:
442
Plugin Contributions:
0

Re: Is a Permanent Login (Auto-Login) Possible?

studeo
try firefox or netscape browsers

check that the login cookie is saved with Ie7 (presumably theres a way)

16 Jun 2007, 10:57 PM
#49
studeo avatar

studeo

Zen Follower

Join Date:
Jan 2007
Posts:
198
Plugin Contributions:
0

Re: Is a Permanent Login (Auto-Login) Possible?

Im sorry to say that it is not effective in Firefox either. I will recheck my files but I believe I install all correctly.

16 Jun 2007, 11:11 PM
#50
studeo avatar

studeo

Zen Follower

Join Date:
Jan 2007
Posts:
198
Plugin Contributions:
0

Re: Is a Permanent Login (Auto-Login) Possible?

More info:

I stay logged in as long as the browser is open. If I close and go back to the site, no login. I re-upped all files again just in case, but same non-results.

Any advice?

PS: If we can make this work, there is a bold NB: at the beginning of the check box line I would like to edit. Which file would that be in?

Thanks

16 Jun 2007, 11:12 PM
#51
ryk avatar

ryk

Totally Zenned

Join Date:
Oct 2004
Location:
Southport, UK
Posts:
3,644
Plugin Contributions:
6

Re: Is a Permanent Login (Auto-Login) Possible?

With 1024 downloads since being posted and only a handful of problems reported, then I'd suggest it's more likely something to do with your installation rather than the mod itself.

Development Manager @ JSWeb Ltd - suppliers of Applepay/Googlepay for Zencart
20 years with Zencart !

17 Jun 2007, 12:13 AM
#52
studeo avatar

studeo

Zen Follower

Join Date:
Jan 2007
Posts:
198
Plugin Contributions:
0

Re: Is a Permanent Login (Auto-Login) Possible?

Thats why I came here for help. This is such an easy mod that needs no hand coding. So I installed it again. Still no luck.

What should the cookie say or look like? Perhaps its not even being written, but I do get a cookie from the site at the same time I login.....Im happy that 1023 people have this working....Im no coder but the instructions are very easy....I just came here looking for help.

17 Jun 2007, 12:20 AM
#53
studeo avatar

studeo

Zen Follower

Join Date:
Jan 2007
Posts:
198
Plugin Contributions:
0

Re: Is a Permanent Login (Auto-Login) Possible?

Is it possible this only works for new user accounts?

17 Jun 2007, 12:26 AM
#54
studeo avatar

studeo

Zen Follower

Join Date:
Jan 2007
Posts:
198
Plugin Contributions:
0

Re: Is a Permanent Login (Auto-Login) Possible?

studeo:

Is it possible this only works for new user accounts?

Nevermind this post. I deleted my account and created a new one with no result.

17 Jun 2007, 8:23 AM
#55
ryk avatar

ryk

Totally Zenned

Join Date:
Oct 2004
Location:
Southport, UK
Posts:
3,644
Plugin Contributions:
6

Re: Is a Permanent Login (Auto-Login) Possible?

Sorry - I can't help. I'm no coder either - I merely packaged up the work of others to make installation easy.

Development Manager @ JSWeb Ltd - suppliers of Applepay/Googlepay for Zencart
20 years with Zencart !

17 Jun 2007, 11:46 AM
#56
hareslade avatar

hareslade

Totally Zenned

Join Date:
Nov 2004
Location:
U.K. South Wales
Posts:
442
Plugin Contributions:
0

Re: Is a Permanent Login (Auto-Login) Possible?

Studio, do some detective work... Using firefox.. its all about wheher a cookie got saved in your computer..

Make a new user for zencart, check the 'permanent login' box when you register.
This should create the cookie in your firefox cookie browsers list once processed.

Then in firefox go to:
Tools | options | privacy | click view cookies button,
locate a cookie name similar to 'zencart_cookie_permlogin' ...... if its not there, it won't be possible to be auto logged on later

Cookie 'Content' should be a load of characters long
Cookie 'Domain' will probably be your website without the www, but a dot in front.

Your computer might also be not accepting cookies, there are setup settings for that for each browser. I have the 'allow sites to set cookies' checkbox checked in my firefox (see cookie lists window area).

Difficult to guess further..

17 Jun 2007, 1:16 PM
#57
studeo avatar

studeo

Zen Follower

Join Date:
Jan 2007
Posts:
198
Plugin Contributions:
0

Re: Is a Permanent Login (Auto-Login) Possible?

There is a cookie placed from the domain (with no period at the front) but nothing that says zencart_cookie_permalogin. I suppose this is not going to work for me. Does this mean it wont work for anyone else from my site?

17 Jun 2007, 1:42 PM
#58
studeo avatar

studeo

Zen Follower

Join Date:
Jan 2007
Posts:
198
Plugin Contributions:
0

Re: Is a Permanent Login (Auto-Login) Possible?

thanks to those who tried to help...I have since replaced the modded files with the originals and I will leave it as it is.

studeo

17 Jun 2007, 6:00 PM
#59
studeo avatar

studeo

Zen Follower

Join Date:
Jan 2007
Posts:
198
Plugin Contributions:
0

Re: Is a Permanent Login (Auto-Login) Possible?

Could this have something to do with my server's setting?

PS I really don't want to give up on this.!

17 Jun 2007, 7:52 PM
#60
hareslade avatar

hareslade

Totally Zenned

Join Date:
Nov 2004
Location:
U.K. South Wales
Posts:
442
Plugin Contributions:
0

Re: Is a Permanent Login (Auto-Login) Possible?

studeo ........... well ...... either you make it work, or you give up :)

p.m me with the cart url if its web, I can see then if indeed the cookie gets received at all