Jump to content
Sign in to follow this  
wetzel

very strange session variable behavior

Recommended Posts

So we are in the midst of adjusting to Phoenix, building out my site onto the engine. It's a very big educational site that began a long development process years ago with an oscommerce 2.2 core. A few years ago we built out a Bootstrap 3 presentation layer. Now we are putting in the new engine and and adjusting to Bootstrap 4. It's fun!

We have run into an issue that has us confused, though. It doesn't make any sense at all.

We log in at index.php and when we return to home the navbar tells us we still need to 'login'. It doesn't look like login was successful.  $_session['customer_id'] is not available to the page. However, if we travel to products_info.php, navbar tells us we are actually logged in and $_session['customer_id'] is now available.

Then if we go to account.php it redirects us to 'login.php' but when we get there $_session['customer_id'] is now available again!

If you can figure this out you will have my eternal gratitude. Best.

Edited by wetzel

Share this post


Link to post
Share on other sites

Just some troubleshooting thoughts to give you some places to check. 

Are you using the same includes/application_top.php for all pages?  Phoenix uses a different name for the session ID than older versions of osCommerce did. 

Is the session ID in the URL or do you have a cookie?  Have you checked the cookie to see what values it has?  In general, have you viewed cookies on each page load to see what's happening with them? 

Have you tried disabling cookies (in your browser, with Force Cookies set to false in admin) to see if you have the same behavior? 

Have you checked for weird things like Apache mod_rewrite rules? 

Have you tried making the site all https? 

Have you checked for goofball things like characters before the opening <?php tag in the file?  The infamous byte order mark is an invisible example that you could see with a hex editor.  Check files included before the session starts. 

Does this happen in every browser?  Or just one? 

If you are using Firefox, have you tried Web Developer tools like Web Console and Network while navigating the site?  Have you checked your error logs? 

Have you checked your configure.php values to make sure that they match each other for HTTP and HTTPS? 


Always back up before making changes.

Share this post


Link to post
Share on other sites

Thank you Matt! 

I had tried most everything you mention, but I had not actually experimented with a different browser! Seriously.

So it seemed to work fine in Safari with the problem occurring in Chrome. I reset to default settings under security in Chrome and now it appears to work. 

If anyone has an idea as to why  this was happening, it might be helpful someday for a customer. Otherwise, that's that.

Thank you!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×