PHP syntax OScommerce

I have a page that uses oscommerce

The last page of the order system i redirects using this:

    if (strlen($notify_string) > 0) $notify_string = substr($notify_string, 0, -1);

    tep_redirect(tep_href_link(FILENAME_DEFAULT, $notify_string));
  }

I believe the tep_redirect(tep_href_link(FILENAME_DEFAULT, $notify_string));

is what is directing the page to the new page.  Because my server has the secure directory in another folder it is trying to find the index.php page in the wrong folder.  How can I change the above code to go straigt to the home page at http://www.jansboatproducts.biz?
muligruberAsked:
Who is Participating?
 
topscoderConnect With a Mentor Commented:
well, i just checked the tep_redirect function.

<?php
  20  ////
  21  // Redirect to another page or site
  22    function tep_redirect($url) {
  23      if ( (ENABLE_SSL == true) && (getenv('HTTPS') == 'on') ) { // We are loading an SSL page
  24        if (substr($url, 0, strlen(HTTP_SERVER)) == HTTP_SERVER) { // NONSSL url
  25          $url = HTTPS_SERVER . substr($url, strlen(HTTP_SERVER)); // Change it to SSL
  26        }
  27      }
  28  
  29      header('Location: ' . $url);
  30  
  31      tep_exit();
  32    }
?>
as you can see, the tep_redirect function also uses the header function of PHP.

if you still want to use the osCommerce function, you could use the next code i think:

<?php
if (strlen($notify_string) > 0) $notify_string = substr($notify_string, 0, -1);
     tep_redirect( "http://www.jansboatproducts.biz" );
}
0
 
topscoderCommented:
i don't know the api of the functions of oscommerce, but you could redirect using the header() function of PHP like:

<?php
if (strlen($notify_string) > 0) $notify_string = substr($notify_string, 0, -1);
     // do not use the next function, so comment that line
     // tep_redirect( tep_href_link( FILENAME_DEFAULT, $notify_string));
     // but use the header function of PHP
     header("Location: http://www.jansboatproducts.biz");
}
0
 
aminerdCommented:
I'd examine the value of FILENAME_DEFAULT; that may be the better place to modify the redirection. For instance, right about the tep_redirect, add:

var_dump(FILENAME_DEFAULT); die();

Now, do whatever you'd normally do to fire the redirect. You'll get the value of that constant instead. Changing the constant definition means you only have to change this in one place.
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.