Zen Cart Logo
Forums / Bug Reports / Redirect to Home Page When Previewing Products in Admin

Redirect to Home Page When Previewing Products in Admin

Views: 5,738

Results 1 to 7 of 7
7 Nov 2012, 2:06 AM
#1
numinix avatar

numinix

Totally Zenned

Join Date:
Apr 2007
Location:
Vancouver, Canada
Posts:
1,567
Plugin Contributions:
58

Redirect to Home Page When Previewing Products in Admin

A couple of our clients using Zen Cart 1.5.1 have reported that occasionally, when editing products, they will go to click the "Preview" button and end up getting redirected to their admin index page and all of the work they did on that product will be lost.

The only code I can find is related to the securityToken which could be an issue related to handling of sessions. Has anyone else noticed this bug?

Code from /YOUR_ADMIN/includes/init_includes/init_sessions.php:

// lets start our session
  zen_session_start();
  $session_started = true;

if (! isset ( $_SESSION ['securityToken'] ))
{
  $_SESSION ['securityToken'] = md5 ( uniqid ( rand (), true ) );
}
if ((isset ( $_GET ['action'] ) || isset($_POST['action']) ) && $_SERVER['REQUEST_METHOD'] == 'POST')
{
  if ((! isset ( $_SESSION ['securityToken'] ) || ! isset ( $_POST ['securityToken'] )) || ($_SESSION ['securityToken'] !== $_POST ['securityToken']))
  {
    zen_redirect ( zen_href_link ( FILENAME_DEFAULT, '', 'SSL' ) );
  }
}
7 Nov 2012, 2:07 AM
#2
numinix avatar

numinix

Totally Zenned

Join Date:
Apr 2007
Location:
Vancouver, Canada
Posts:
1,567
Plugin Contributions:
58

Re: Redirect to Home Page When Previewing Products in Admin

BTW, the product page form does have the securityToken and the page has no HTML nesting errors and most of the time there is no issue.

31 Jan 2013, 8:00 AM
#3
thematysek avatar

thematysek

New Zenner

Join Date:
Dec 2006
Location:
Prague
Posts:
5
Plugin Contributions:
3

Re: Redirect to Home Page When Previewing Products in Admin

My users have the very same problem. It's rare but it's happening (as they claim)...
Has anyone ever found out what was wrong? I'd love to hear it!
Many thanks

20 Feb 2013, 12:23 PM
#4
thematysek avatar

thematysek

New Zenner

Join Date:
Dec 2006
Location:
Prague
Posts:
5
Plugin Contributions:
3

Re: Redirect to Home Page When Previewing Products in Admin

The redirect to the admin homepage can be caused by a missing securityToken in the form which had been POSTed as described here:
http://www.zen-cart.com/showthread.php?130410-June-2009-Admin-Security-Patch-vs-some-Addons-Contributions

However, there's a second reason for this to be happening... One of my users kept complaining about it and it took me ages to find out what it was. He was simply using the admin from a few different browser tabs at once. If you open a (post) form in one browser tab and then browse the admin pages from a second tab then the new security code can be generated on the server from the new tab and when you submit the form in the original tab it will fail the validation (maybe you need to logout/timeout and log back in in the second tab to achieve the error).

Hopefully it will save some time for someone with creative admin-users. It took me ages to find out :-/

15 Aug 2013, 2:32 PM
#5
time111 avatar

time111

New Zenner

Join Date:
Sep 2008
Posts:
95
Plugin Contributions:
0

Re: Redirect to Home Page When Previewing Products in Admin

numinix:

A couple of our clients using Zen Cart 1.5.1 have reported that occasionally, when editing products, they will go to click the "Preview" button and end up getting redirected to their admin index page and all of the work they did on that product will be lost.

The only code I can find is related to the securityToken which could be an issue related to handling of sessions. Has anyone else noticed this bug?

I noticed this same thing with my client, however to save data, dont go back to category and then open the product, in place of that just press back button on browser and you will see all data intact on product page, then you can press preview and update and it will work.

~Time

16 Aug 2013, 7:35 PM
#6
numinix avatar

numinix

Totally Zenned

Join Date:
Apr 2007
Location:
Vancouver, Canada
Posts:
1,567
Plugin Contributions:
58

Re: Redirect to Home Page When Previewing Products in Admin

If you check the web console in Firefox, you may notice a 500 Internal Server Error when the home page loads. Often the culprit is invalid post data that PHP wasn't able to handle. If you are creating product descriptions in another program, it could be adding invalid characters or formatting that is causing the error.

The best way to avoid this is to use either plain text and create your HTML code directly in the textarea, or use a WYSIWYG editor that is integrated into Zen Cart such as CK Editor.

12 Feb 2014, 12:01 AM
#7
carlwhat avatar

carlwhat

zennedOut

Join Date:
Nov 2005
Location:
los angeles
Posts:
2,962
Plugin Contributions:
8

Re: Redirect to Home Page When Previewing Products in Admin

with this new security addition as documented here:

http://www.zen-cart.com/showthread.php?130410

no logging gets done. basically this patch says there is a problem with the security, and we are just going to redirect you to the admin home page. why the maintainers of zen chose to not log this security breach is a mystery to me.