PHP syntax OScommerce

Posted on 2006-05-17
Last Modified: 2012-06-21
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
Question by:muligruber
    LVL 2

    Expert Comment

    i don't know the api of the functions of oscommerce, but you could redirect using the header() function of PHP like:

    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
    LVL 2

    Accepted Solution

    well, i just checked the tep_redirect function.

      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      }
      29      header('Location: ' . $url);
      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:

    if (strlen($notify_string) > 0) $notify_string = substr($notify_string, 0, -1);
         tep_redirect( "" );
    LVL 5

    Expert Comment

    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.

    Featured Post

    Gigs: Get Your Project Delivered by an Expert

    Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

    Join & Write a Comment

    Things That Drive Us Nuts Have you noticed the use of the reCaptcha feature at EE and other web sites?  It wants you to read and retype something that looks like this.Insanity!  It's not EE's fault - that's just the way reCaptcha works.  But it is …
    Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
    The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
    The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

    755 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    24 Experts available now in Live!

    Get 1:1 Help Now