Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

How do you redirect from login.php to Secure pages


Guest

Recommended Posts

Posted

Hello all!

 

PROBLEM:

 

Whe you have an item in your cart and you try to checkout - you get directed to the login.php page (on secure server i.e. https page). After logging in you get a warning that "you are being redirected to an insecure page..."

 

I am having problems in trying to solve how to redirect from the login.php page to a SECURE (https) checkout_shipping.php - BUT ONLY WHEN THERE ARE ITEMS IN MY CART!

 

If you log yourself in first (before adding items to your cart) the warning does not appear - because of changes made thanks to the following link Redirect to secure page

 

Unfortunately, the solution in the above link does not solve my problem.

 

I think i know what the cause is, but cannot figure out how to make the following redirect to an SSL page:

 

In file login.php:

 

// restore cart contents 
   $cart->restore_contents(); 

       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 { 

//old submit without SSL:          tep_redirect(tep_href_link(FILENAME_DEFAULT)); 
//NEW SUBMIT WITH SSL BELOW
tep_redirect(tep_href_link(FILENAME_DEFAULT, ' ', 'SSL'));

 

The above seems to tell the login page to redirect to the original page - i.e. the page before the "secured" login.php page - and this page is not secure... therefore you get the warning!

 

I have tried to change the above code to make it redirect to a secure server by adding the following:

 

The code change is:

 tep_redirect($origin_href);  

To this:

 tep_redirect($origin_href, 'SSL');

 

However this does nothing!

 

Does anyone know how to modify the above code so that it does go to a secure page?

 

Thank you!

 

Jit

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...