The Boston Diaries

The ongoing saga of a programmer who doesn't live in Boston, nor does he even like Boston, but yet named his weblog/journal “The Boston Diaries.”

Go figure.

Thursday, March 10, 2005

Lovely … I get to debug code in PHP

I made a test order and when I clicked confirm order the next page said page cannot be displayed or error page, I am not sure. Please place a test order and let us know if it is working properly.

Trouble ticket I recieved this afternoon.

And thus I started my descent into osCommerce, written in PHP of course.

It took long enough, but I was able to finally track the problem down to the following bit of code:

function tep_href_link(
	$page = '', 
	$parameters = '', 
	$connection = 'NONSSL', 
	$add_session_id = true, 
	$search_engine_safe = true
) 
{
  global $request_type, $session_started, $SID;

  if (!tep_not_null($page)) {
    die( error message with embedded HTML code, of course );
  }

  if ($connection == 'NONSSL') {
    $link = HTTP_SERVER . DIR_WS_HTTP_CATALOG;
  } elseif ($connection == 'SSL') {
    if (ENABLE_SSL == true) {
      $link = HTTPS_SERVER . DIR_WS_HTTPS_CATALOG;
    } else {
      $link = HTTP_SERVER . DIR_WS_HTTP_CATALOG;
    }
  } else {
    die( yet another error message with embedded HTML code );
  }
  // rest of function deleted 
}

catalog/includes/functions/html_output.php

The checkout code is running under a secure server (secure.example.net) while the actual site itself is under a different domain (www.example.com) and for some reason, the code, in generating the link, is getting things mixed up and the link is being generated incorrectly. It's getting the secure server name (HTTPS_SERVER) but tacking on the location on the non-secure site (DIR_WS_HTTP_CATALOG) and thus leading to the dreaded 404 Not Found error.

I'm not really keen on trying to debug this any futher than I have to (the osCommerce package comprises over 500 files), I basically changed the code to look like:

if ($connection == 'NONSSL') {
  $link = HTTPS_SERVER . DIR_WS_HTTPS_CATALOG; // XXX - spc hack
} elseif ($connection == 'SSL') {
// rest snipped

It works (even if it is a hack). Customer is happy. I'm happy (that I no longer have to dig into this program).

Now back to the salt mines—the customer is now wondering why he isn't getting his email …


'tis to be expected I guess

I forgot about this. A few days the NAP of the Americas sent out a message about an upcoming maintenance window.

In Microsoft Word format.

Of course everybody uses Microsoft Windows.

Of course.

This would seem to explain their rather odd stance of not having a crash cart anywhere in the six story data center.

Because, you know, everybody uses Microsoft Windows. For everything. Including servers.

I'm getting less and less impressed with the NAP of the Americas.

Because, you know, everybody uses Microsoft Windows.

Obligatory Picture

[The future's so bright, I gotta wear shades]

Obligatory Contact Info

Obligatory Feeds

Obligatory Links

Obligatory Miscellaneous

You have my permission to link freely to any entry here. Go ahead, I won't bite. I promise.

The dates are the permanent links to that day's entries (or entry, if there is only one entry). The titles are the permanent links to that entry only. The format for the links are simple: Start with the base link for this site: https://boston.conman.org/, then add the date you are interested in, say 2000/08/01, so that would make the final URL:

https://boston.conman.org/2000/08/01

You can also specify the entire month by leaving off the day portion. You can even select an arbitrary portion of time.

You may also note subtle shading of the links and that's intentional: the “closer” the link is (relative to the page) the “brighter” it appears. It's an experiment in using color shading to denote the distance a link is from here. If you don't notice it, don't worry; it's not all that important.

It is assumed that every brand name, slogan, corporate name, symbol, design element, et cetera mentioned in these pages is a protected and/or trademarked entity, the sole property of its owner(s), and acknowledgement of this status is implied.

Copyright © 1999-2024 by Sean Conner. All Rights Reserved.