Jump to content
Sign in to follow this  
Pelvis

OSCommerce - Redirect to navigation snapshot doesn't work

Recommended Posts

I use OSCommerce v2.2 and what I want is when the user visits a page that redirects him to login after a successful login to be redirected to the page that initially visited.

For example, the user receives an email that prompts him to visit the page review.php he clicks the page and gets redirect to login.php. After the login I want him to be redirected to review.php

OSCommerce seems to have this functionality at login.php

if (sizeof($navigation->snapshot) > 0) {
  $origin_href = tep_href_link($navigation->snapshot['page'], tep_array_to_string($navigation->snapshot['get'], array(tep_session_name())), $navigation->snapshot['mode']);
  $navigation->clear_snapshot();
  tep_redirect($origin_href);
} else {
  tep_redirect(tep_href_link(FILENAME_DEFAULT));
}

And at the review.php file, the snapshot is set when the user is not logged in.

$navigation->set_snapshot();
tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));

but then in application_top.php the following code seems to destroy the navigation snapshot

// navigation history
  if (tep_session_is_registered('navigation')) {
    if (PHP_VERSION < 4) {
      $broken_navigation = $navigation;
      $navigation = new navigationHistory;
      $navigation->unserialize($broken_navigation);
    }
  } else {
    tep_session_register('navigation');
    $navigation = new navigationHistory;
  }
  $navigation->add_current_page();

So before I fix this with my own session variables I would like to use the implemented functionality. Has anyone experienced the same problem and came up with a solution to the default functionality?

P.S The PHP version of the site is 7.2

Thanks for your time :-)

Edited by Pelvis

Share this post


Link to post
Share on other sites

Will removal of the nested if help? As follows:

Quote

// navigation history
  if (!tep_session_is_registered('navigation')) {
    tep_session_register('navigation');
    $navigation = new navigationHistory;
  }
  $navigation->add_current_page();

 

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  

×