Zen Cart Logo
Forums / Bug Reports / [Done 160] V154 & V155 cookies off zenid changing w every page change. add item fails

[Done 160] V154 & V155 cookies off zenid changing w every page change. add item fails

Locked

Views: 25,254

Results 1 to 20 of 27
This thread is locked. New replies are disabled.
22 Jun 2016, 10:16 PM
#1
brittainmark avatar

brittainmark

Totally Zenned

Join Date:
Apr 2009
Posts:
507
Plugin Contributions:
1

[Done 160] V154 & V155 cookies off zenid changing w every page change. add item fails

In V154 and 155. I have been testing with cookies refused. I have discovered that the Session id zenid changes every time you click on a link. I have tested this in fire fox and crome and both have the same issue. This I think then causes a whoops time out message to be displayed when you try to add an item to the cart.

I store the session info in the database and the session record is being created and destroyed for each new click.

You can see this if you turn off cookies and then go to the site then hover over a link you will see that the session id has changed for the next click.

I had to click once to get a zenid but from then on all the links have a different zenid.

I assume for a session to work the new links should have the same zenid (session id).

23 Jun 2016, 2:39 AM
#2
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: [Done 160] V154 & V155 cookies off zenid changing w every page change. add item fails

Not a bug.

If your store is set to require cookies but you turn cookies off in your browser, then it's not going to work.
Simple solution: don't do that.

Question: why are you doing that?

23 Jun 2016, 7:55 AM
#3
brittainmark avatar

brittainmark

Totally Zenned

Join Date:
Apr 2009
Posts:
507
Plugin Contributions:
1

Re: [Done 160] V154 & V155 cookies off zenid changing w every page change. add item fails

Store is not set to require cookies. Force cookie use is false. Should it be true?

I was testing it because a number of customers complained that they could not add items to the basket. I was guessing that they had turned cookies off.

DrByte:

Not a bug.

If your store is set to require cookies but you turn cookies off in your browser, then it's not going to work.
Simple solution: don't do that.

Question: why are you doing that?

23 Jun 2016, 8:47 AM
#4
brittainmark avatar

brittainmark

Totally Zenned

Join Date:
Apr 2009
Posts:
507
Plugin Contributions:
1

Re: [Done 160] V154 & V155 cookies off zenid changing w every page change. add item fails

I can make it work by changing init_sessions.php about line 51.
from```php
if (isset($_POST[zen_session_name()])) {
zen_session_id($_POST[zen_session_name()]);
} elseif ( ($request_type == 'SSL') && isset($_GET[zen_session_name()]) ) {
zen_session_id($_GET[zen_session_name()]);
}

to
```php
if (isset($_POST[zen_session_name()])) {
  zen_session_id($_POST[zen_session_name()]);
} elseif ( ($request_type == 'SSL') && isset($_GET[zen_session_name()]) ) {
  zen_session_id($_GET[zen_session_name()]);
  /* else if added Mjfb*/
} elseif (isset($_GET[zen_session_name()])) {
	zen_session_id($_GET[zen_session_name()]);
}

Does this break the certification for zen cart?
Also it does not appear to show the cookies required page any more. Just goes to whoops your session has timed out (time out page).

23 Jun 2016, 10:16 AM
#5
mc12345678 avatar

mc12345678

Totally Zenned

Join Date:
Jul 2012
Posts:
16,908
Plugin Contributions:
2

Re: [Done 160] V154 & V155 cookies off zenid changing w every page change. add item fails

What template is/was used in your testing? Does this occur in the default template for these two stores (when you don't have the extra code added to the init_session.php file?)

Seeing as you are a long time forum member, what is the history of upgrade including process(es) used?

23 Jun 2016, 11:03 AM
#6
brittainmark avatar

brittainmark

Totally Zenned

Join Date:
Apr 2009
Posts:
507
Plugin Contributions:
1

Re: [Done 160] V154 & V155 cookies off zenid changing w every page change. add item fails

I performed a fresh install of 155 on my test machine with the test data and it has the same problem on that.
I was using the responsive classic template on that. I have tried classic green and get the same issue goes to index.php?main_page=time_out&zenid=co24rosqf910i1i5eg8u9r9i37 when trying to add to cart. the links all have &zenid=g3a5efvifobos3q6g2ojcokq75 so will have same issue.

For the live site I started life as 1.3.0 and has been upgraded through all the releases to 1.5.4 it now uses a modified responsive sheffield blue template.

23 Jun 2016, 5:46 PM
#7
wilt avatar

wilt

Oji-san

Join Date:
Jun 2003
Location:
Newcastle UK
Posts:
1,837
Plugin Contributions:
3

Re: [Done 160] V154 & V155 cookies off zenid changing w every page change. add item fails

Hi Mark

Do you have settings in Apache to do any kind of redirects.
Also would you mind telling us who your host is.

23 Jun 2016, 6:50 PM
#8
brittainmark avatar

brittainmark

Totally Zenned

Join Date:
Apr 2009
Posts:
507
Plugin Contributions:
1

Re: [Done 160] V154 & V155 cookies off zenid changing w every page change. add item fails

the zen cart is in a sub directory of the main site.
The htaccess settings on the top level directory are

#reset default page 
DirectoryIndex index.php


Options +FollowSymlinks

# allow URl rewriting

RewriteEngine on


#change htm to php

RewriteRule ^(.*)\.htm$ $1.php

# stop pages being taken

RewriteCond %{HTTP_REFERER} !^$
RewriteCond %{HTTP_REFERER} !^http://(www\.)?schoolofinnerlight\.co\.uk/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?innerlightcrystals\.co\.uk/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?innerlighttherapies\.co\.uk/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?innerlightworkers\.co\.uk/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?.*\.lotuslight\.co\.uk/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?theangelicartoftransformation\.co\.uk/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?angelicmultidimensionalhealing\.co\.uk/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?lotuslight\.co\.uk/.*$ [NC]
RewriteCond %{HTTP_REFERER} !^http://(www\.)?alexa\.com/.*$ [NC]
Rewritecond %{HTTP_REFERER} !^http://(www\.)?images\.google.*$ [NC]
Rewritecond %{HTTP_REFERER} !^http://(www\.)?translate\..*$ [NC]
Rewritecond %{HTTP_REFERER} !^http://(www\.)?joyousisle\.com/.*$ [NC]
RewriteRule .*\.(jpg|gif|bmp|png)$        -                   [F,NC]

RewriteCond %{HTTP_HOST} !^innerlightcrystals\.co\.uk$ [NC]
RewriteRule .? http://innerlightcrystals.co.uk%{REQUEST_URI} [R=301,L]

My host is Ukhost4u. My site is http://innerlightcrystals.co.uk/sales/

My test server is Ubuntu run as a virtual machine (oracle vbox). I have removed all the rewrites and I still have the same issue on 155a running classic green or responsive classic. If you need more details of the virtual machine please let me know.

If any of the info in the code section should not be public please remove it for me.

Thanks

8 Jul 2016, 9:25 AM
#9
brittainmark avatar

brittainmark

Totally Zenned

Join Date:
Apr 2009
Posts:
507
Plugin Contributions:
1

Re: [Done 160] V154 & V155 cookies off zenid changing w every page change. add item fails

Any movement on this? If not a fault do I need to have specific setting?

8 Jul 2016, 1:55 PM
#10
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: [Done 160] V154 & V155 cookies off zenid changing w every page change. add item fails

If you turn off ENABLE_SSL does the problem go away?
(The code-change you posted suggests that your server isn't properly representing SSL.)

Additionally, is your html_output.php function file altered in any way?

10 Jul 2016, 8:51 AM
#11
brittainmark avatar

brittainmark

Totally Zenned

Join Date:
Apr 2009
Posts:
507
Plugin Contributions:
1

Re: [Done 160] V154 & V155 cookies off zenid changing w every page change. add item fails

Was set to '' set to 'false' still no change when cookies off. this is on a clean install of 1.55a with test data so no other changes.

DrByte:

If you turn off ENABLE_SSL does the problem go away?
(The code-change you posted suggests that your server isn't properly representing SSL.)

Additionally, is your html_output.php function file altered in any way?

10 Jul 2016, 7:42 PM
#12
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: [Done 160] V154 & V155 cookies off zenid changing w every page change. add item fails

And why exactly are you forcing cookies off?

10 Jul 2016, 8:49 PM
#13
brittainmark avatar

brittainmark

Totally Zenned

Join Date:
Apr 2009
Posts:
507
Plugin Contributions:
1

Re: [Done 160] V154 & V155 cookies off zenid changing w every page change. add item fails

Because a customer complained that they could not put an item into the basket. This was the only scenario that I could reproduce the problem. I would not have an issue if it went to the this sites requires cookies but it does not I just says that the session has expired. Which as this is not true all that has happened is that the session id has a new id allocated to all the links when cookies are turned off. The change I put in kept the original ID. What I would like to happen is, if zen cart needs cookies which I think is what you are trying to say then the cookies are off page should be displayed.
I cannot get the cookies page to be displayed even in a fresh install of the system with no addins or alterations.

DrByte:

And why exactly are you forcing cookies off?

11 Jul 2016, 1:14 AM
#14
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: [Done 160] V154 & V155 cookies off zenid changing w every page change. add item fails

Okay, let's turn on the setting to require cookies: Force Cookie Use = true.
I believe that'll show the "requires cookies" page if they're disabled.

11 Jul 2016, 1:32 PM
#15
brittainmark avatar

brittainmark

Totally Zenned

Join Date:
Apr 2009
Posts:
507
Plugin Contributions:
1

Re: [Done 160] V154 & V155 cookies off zenid changing w every page change. add item fails

Sorry no change still goes to the time out page when force cookie use is true and cookies are turned off.

Attached picture of settings
Attachment 16479

The difference is that the zenid is not displayed.

A question. Is zen cart designed to work with cookies off?

11 Jul 2016, 3:15 PM
#16
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: [Done 160] V154 & V155 cookies off zenid changing w every page change. add item fails

brittainmark:

A question. Is zen cart designed to work with cookies off?
Essentially yes. But I never use it that way so if there are issues with it I'm not seeing them.
In fact, there are many who strongly recommend Force Cookie Use = true for various reasons unrelated to your symptoms.

That said, I can't seem to duplicate the symptoms you're reporting ... which is frustrating for both of us.

11 Jul 2016, 4:31 PM
#17
brittainmark avatar

brittainmark

Totally Zenned

Join Date:
Apr 2009
Posts:
507
Plugin Contributions:
1

Re: [Done 160] V154 & V155 cookies off zenid changing w every page change. add item fails

I know Just what you mean.
Could it be a php version issue?
My live servers use: Apache Version 2.4.16, PHP Version 5.4.45, MySQL Version 5.6.30

On my test server I am using : Apache/2.4.7 ,PHP Version 5.5.9 , MySQL Version 5.5.49.

Don't know if you use virtual box. If it would help I could build you a virtual machine. (they tend to be big so would have to put it on an ftp site for you.).

I'll try a top level install on my test site with 1.5.5a and no extras to see if that solves it. If it does then it is definitely my servers.

11 Jul 2016, 5:19 PM
#18
brittainmark avatar

brittainmark

Totally Zenned

Join Date:
Apr 2009
Posts:
507
Plugin Contributions:
1

Re: [Done 160] V154 & V155 cookies off zenid changing w every page change. add item fails

Just done another completely clean install. same issue. as soon as you turn off cookies the zenid changes for every link on the page. So the zenid in the URL does not match the Zenid on any of the links on the page and when you try to add an item to the cart you go to the timeout page. Just to complete the picture the version of zen cart I am using is zen-cart-v1.5.5a-05052016.

If I can give you any more info Just ask.
Mark

19 Jul 2016, 3:43 PM
#19
brittainmark avatar

brittainmark

Totally Zenned

Join Date:
Apr 2009
Posts:
507
Plugin Contributions:
1

Re: [Done 160] V154 & V155 cookies off zenid changing w every page change. add item fails

Can you tell me where cookies usage or lack of is detected. I'll try to do some digging if I know where to look.

Additionally the admin section will not work at all with cookies turned off. Just keeps returning me to the login page.

19 Jul 2016, 5:19 PM
#20
drbyte avatar

drbyte

Sensei

Join Date:
Jan 2004
Posts:
63,513
Plugin Contributions:
177

Re: [Done 160] V154 & V155 cookies off zenid changing w every page change. add item fails

brittainmark:

Can you tell me where cookies usage or lack of is detected. I'll try to do some digging if I know where to look.init_sessions.php
brittainmark:

Additionally the admin section will not work at all with cookies turned off. Just keeps returning me to the login page.Argh; I'm not seeing that. Very curious why it seems to be unique to your setup...