Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Erratic links are generated when SSL is enabled....


lgpana

Recommended Posts

This only happens when SSL is enabled...

 

On the bottom of the log in screen you will see an error that says:

"Error! Unable to determine the page link!.."

 

Then after logging in, you may get a page cannot be displayed error at any time...

 

If you're lucky to complete the order, if you click on continue on the "checkout_success" page, you will always get a page cannot be displayed error.

 

My server is running PHP 4.3.1 and my SSL cert is from geotrust..

 

Please help!!!

Link to comment
Share on other sites

Below is my catalog/includes/configure.php

----------------------------------------------------------

// Define the webserver and path parameters

// * DIR_FS_* = Filesystem directories (local/physical)

// * DIR_WS_* = Webserver directories (virtual/URL)

define('HTTP_SERVER', 'http://www.hytekpclabs.com'); // eg, http://localhost - should not be empty for productive servers

define('HTTPS_SERVER', 'https://www.hytekpclabs.com'); // eg, https://localhost - should not be empty for productive servers

 

define('ENABLE_SSL',true); // secure webserver for checkout procedure?

define('DIR_WS_CATALOG', '/store/catalog/'); // absolute path required

define('DIR_WS_IMAGES', 'images/');

define('DIR_WS_ICONS', DIR_WS_IMAGES . 'icons/');

define('DIR_WS_INCLUDES', 'includes/');

define('DIR_WS_BOXES', DIR_WS_INCLUDES . 'boxes/');

define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/');

define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/');

define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/');

define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/');

 

define('DIR_WS_DOWNLOAD_PUBLIC', DIR_WS_CATALOG . 'pub/');

define('DIR_FS_DOCUMENT_ROOT', '/home/user/www.hytekpclabs.com');

define('DIR_FS_CATALOG', '/home/user/www.hytekpclabs.com/store/catalog/');

define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/');

define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/');

 

// define our database connection

define('DB_SERVER', 'localhost'); // eg, localhost - should not be empty for productive servers

define('DB_SERVER_USERNAME', 'user');

define('DB_SERVER_PASSWORD', 'pass');

define('DB_DATABASE', 'database');

define('USE_PCONNECT', 'false'); // use persistent connections?

define('STORE_SESSIONS', 'mysql'); // leave empty '' for default handler or set to 'mysql'

?>

-----------------------------------------------------

Thanks for looking out...

Link to comment
Share on other sites

How did it look ok? I did not do anything

 

If you try to place an order, on the bottom of the login screen I still see a message that says "Error! Unable to determine the page link!.."

 

Then if you click on continue on the "checkout_success" page, you will always get a "page cannot be displayed" error.

 

Keep in mind that this only happens when SSL is enabled..

Link to comment
Share on other sites

define('DIR_FS_DOCUMENT_ROOT', '/home/user/www.hytekpclabs.com');

Shouldn't the path end with a "/" ?

 

Does it make a difference?

Link to comment
Share on other sites

mmm, my first guess would be: session-data is not maintained correctly. Try to set the 'STORE_SESSIONS' to 'mysql'. BUT: YOU'VE ALREADY DONE THAT!

 

mmm, it's obvious that something goeswrong with the tep_redirect() function. Could you please post the first 50 lines of catalog/includes/functions/general.php

Greetings from Marcel

|Current version|Documentation|Contributions|

Link to comment
Share on other sites

These are the first 50 lines from the catalog/includes/functions/general.php page

----------------------------------

<?php

/*

$Id: general.php,v 1.212 2003/02/17 07:55:54 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

http://www.oscommerce.com

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

////

// Stop from parsing any further PHP code

function tep_exit() {

tep_session_close();

exit();

}

 

////

// Redirect to another page or site

function tep_redirect($url) {

if ( (ENABLE_SSL == true) && (getenv('HTTPS') == 'on') ) { // We are loading an SSL page

if (substr($url, 0, strlen(HTTP_SERVER)) == HTTP_SERVER) { // NONSSL url

$url = HTTPS_SERVER . substr($url, strlen(HTTP_SERVER)); // Change it to SSL

}

}

 

header('Location: ' . $url);

 

tep_exit();

}

 

////

// Error message wrapper

// When optional parameters are provided, it closes the application

// (ie, halts the current application execution task)

function tep_error_message($error_message, $close_application = false, $close_application_error = '') {

echo $error_message;

 

if ($close_application == true) {

die($close_application_error);

}

}

 

////

// Return a random row from a database query

function tep_random_select($query) {

$random_product = '';

$random_query = tep_db_query($query);

$num_rows = tep_db_num_rows($random_query);

if ($num_rows > 0) {

$random_row = tep_rand(0, ($num_rows - 1));

tep_db_data_seek($random_query, $random_row);

$random_product = tep_db_fetch_array($random_query);

}

 

return $random_product;

}

 

////

// Return a product's name

// TABLES: products

function tep_get_products_name($product_id, $language = '') {

global $languages_id;

 

if (empty($language)) $language = $languages_id;

 

$product_query = tep_db_query("select products_name from " . TABLE_PRODUCTS_DESCRIPTION . " where products_id = '" . $product_id

. "' and language_id = '" . $language . "'");

$product = tep_db_fetch_array($product_query);

 

return $product['products_name'];

}

 

////

// Return a product's special price (returns nothing if there is no offer)

// TABLES: products

function tep_get_products_special_price($product_id) {

$product_query = tep_db_query("select specials_new_products_price from " . TABLE_SPECIALS . " where products_id = '" . $product_

id . "' and status");

$product = tep_db_fetch_array($product_query);

 

return $product['specials_new_products_price'];

}

 

////

// Return a product's stock

// TABLES: products

function tep_get_products_stock($products_id) {

----------------------------------------------------------------------------

 

Thanks for the help marcel..

Link to comment
Share on other sites

After thinking, thinking and more thinking I come to the conclusion that the problem is in:

 

catalog/includes/filenames.php or if you do not have this:

catalog/includes/application_top.php

 

Search for:

define('FILENAME_DEFAULT',.......

I think this line is corrupt!

 

It should be

  define('FILENAME_DEFAULT', 'default.php');

Greetings from Marcel

|Current version|Documentation|Contributions|

Link to comment
Share on other sites

The code on catalog/includes/application_top.php was correct.

define('FILENAME_DEFAULT', 'default.php');

 

this is the 50 lines from catalog/includes/functions/html_output.php

 

<?php

/*

 $Id: html_output.php,v 1.49 2003/02/11 01:31:02 hpdl Exp $



 osCommerce, Open Source E-Commerce Solutions

 http://www.oscommerce.com



 Copyright (c) 2003 osCommerce



 Released under the GNU General Public License

*/



////

// Parse the data used in the html tags to ensure the tags will not break

 function tep_parse_input_field_data($data, $parse) {

   return strtr(trim($data), $parse);

 }



////

// The HTML href link wrapper function

 function tep_href_link($page = '', $parameters = '', $connection = 'NONSSL', $add_session_id = true, $search_engine_safe = true) {

   if (!tep_not_null($page)) {

     die('</td></tr></table></td></tr></table><br><br><font color="#ff0000"><b>Error!</b></font><br><br><b>Unable to determine the 

page link!<br><br>');

   }



   if ($connection == 'NONSSL') {

     $link = HTTP_SERVER . DIR_WS_CATALOG;

   } elseif ($connection == 'SSL') {

     if (ENABLE_SSL == true) {

       $link = HTTPS_SERVER . DIR_WS_CATALOG;

     } else {

       $link = HTTP_SERVER . DIR_WS_CATALOG;

     }

   } else {

     die('</td></tr></table></td></tr></table><br><br><font color="#ff0000"><b>Error!</b></font><br><br><b>Unable to determine conn

ection method on a link!<br><br>Known methods: NONSSL SSL</b><br><br>');

   }



   if (tep_not_null($parameters)) {

     $link .= $page . '?' . $parameters;

     $separator = '&';

   } else {

     $link .= $page;

     $separator = '?';

   }



   while ( (substr($link, -1) == '&') || (substr($link, -1) == '?') ) $link = substr($link, 0, -1);



// Add the session ID when moving from HTTP and HTTPS servers or when SID is defined

   if ( (ENABLE_SSL == true ) && ($connection == 'SSL') && ($add_session_id == true) ) {

     $sid = tep_session_name() . '=' . tep_session_id();

   } elseif ( ($add_session_id == true) && (tep_not_null(SID)) ) {

     $sid = SID;

   }



   if ( (SEARCH_ENGINE_FRIENDLY_URLS == 'true') && ($search_engine_safe == true) ) {

     while (strstr($link, '&&')) $link = str_replace('&&', '&', $link);



     $link = str_replace('?', '/', $link);

     $link = str_replace('&', '/', $link);

     $link = str_replace('=', '/', $link);



     $separator = '?';

   }

   

   if (isset($sid)) {

     $link .= $separator . $sid;

   }



   return $link;

 }



////

// The HTML image wrapper function

 function tep_image($src, $alt = '', $width = '', $height = '', $parameters = '') {

   if ( (empty($src) || ($src == DIR_WS_IMAGES)) && (IMAGE_REQUIRED == 'false') ) {

     return false;

   }



// alt is added to the img tag even if it is null to prevent browsers from outputting

// the image filename as default

   $image = '<img src="' . tep_parse_input_field_data($src, array('"' => '"')) . '" border="0" alt="' . tep_parse_input_field_

data($alt, array('"' => '"')) . '"';



   if (tep_not_null($alt)) {

     $image .= ' title=" ' . tep_parse_input_field_data($alt, array('"' => '"')) . ' "';

   }



   if ( (CONFIG_CALCULATE_IMAGE_SIZE == 'true') && (empty($width) || empty($height)) ) {

     if ($image_size = @getimagesize($src)) {

       if (empty($width) && tep_not_null($height)) {

Link to comment
Share on other sites

The weird thing is:

 

When you move around the pages with your mouse, all links to default.php are corrupted. Try it. When you have to default.php loaded:

 

move over the language flags and look at the url in the statusbar. same with the little shoppingcarts in the order-history box. I assume that this is the same reason for the failing checkout. After checkout_succes you should be redirected to default.php.

 

But it only goes wrong when logged on... Did you have to upload your php files twice? once to http and once to https?? Is so, please check the same files in the other place.

Greetings from Marcel

|Current version|Documentation|Contributions|

Link to comment
Share on other sites

I think it's a server issue...

 

I installed the same exact version of oscommerce on a different server using a shared SSL cert and it works fine.. with SSL enabled..

 

my hosting company claims that they had to recompile PHP 4.3.1 on my account after he installed my SSL cert.

 

also keep in mind that if SSL is not enabled, the shopping cart works fine.

 

What could be wrong on the server? any ideas..

Link to comment
Share on other sites

I just hitted the bottom of my idea-well! Next suggestion is to attempt a full re-install (save your configure.php's first).

 

Might indeed be a server-issue... but the behaviour is too predictable to be just a memory-fault or other hardware issue. Perhaps the php-build showed some errors.

 

I don't know it anymore. But I would like to be informed if you find a solution.

 

Good luck!

Greetings from Marcel

|Current version|Documentation|Contributions|

Link to comment
Share on other sites

Hi,

 

I don't know if this is the right thread to post this on or not, but I suspect my problem has something to do with SIDs. I had SSL working swimmingly since the very beginning with no problems. I installed Ian's SID killer on April 20 and it was doing its job well as no SIDs showed up when I tested at http://www.webconfs.com/search-engine-spid...r-simulator.php. Now, on April 25, our provider's SSL server broke down. Well, I finally got them to restart it today, but when I go to checkout, after logging in, it sends me back to the main page. Even worse, you try it again and get the following:

 

An error occured while loading https://www1.sitessl.com/~wh57512/catalog/l...=process&osCis= . . . . .

 

Connection to host www1.sitessl.com is broken

 

where the . . . . . . . is a SID. The checkout works fine if you disable SSL.

 

So I do some reading and discover that Ian's SID killer has some problems with SSL. So I went in application_top.php and html_output.php and completely uninstalled the SID killer. However, this did not fix the SSL checkout procedure!

 

So now I'm wondering if this is the result of one of my other mods (I doubt this because I would have noticed a problem earlier) or the result of my hosting provider not restarting the SSL server correctly. I don't want to go barking up the wrong tree if you know what I mean . . .

 

Thanks,

Ben

Link to comment
Share on other sites

Indeed, this is not the right thread for your question. Next time, please start a new thread. :D

 

If the only thing that is changed, is the restored ssl-server, I would look there first!

 

BTW clicking the ssl link you provided shows me a normal loginscreen. Perhaps you should empty your browser's cache?

Greetings from Marcel

|Current version|Documentation|Contributions|

Link to comment
Share on other sites

  • 1 year later...

Found the answer if anyone is interested.....

 

This problem is due to the redirect-function "tep_redirect" (see file "\catalog\includes\functions\general.php"). It assumes that your catalog is in the same directory for NON-SSL as for SSL, where in fact it isn't.

 

I changed this function to the following and it is working perfectly (try at your own risk ;) ):

 

 ?function tep_redirect($url) {
? ?if ( (ENABLE_SSL == true) && (getenv('HTTPS') == 'on') ) { // We are loading an SSL page
? ? ?if (substr($url, 0, strlen(HTTP_SERVER)) == HTTP_SERVER) { // NONSSL url
? ? ? ?$url = HTTPS_SERVER . DIR_WS_HTTPS_CATALOG . substr($url, strlen(HTTP_SERVER . DIR_WS_HTTP_CATALOG)); // Change it to SSL
? ? ?}
? ?}
? ?header('Location: ' . $url);

? ?tep_exit();
?}

Link to comment
Share on other sites

  • 2 years later...
  • 5 weeks later...

Nihil, I was at your site.

 

At least part of your problem will be solved if you do this:

 

Click Me

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

 

"Given enough impetus a parallelogramatically shaped projectile can egress a circular orifice."

- Me -

 

"Headers already sent" - The definitive help

 

"Cannot redeclare ..." - How to find/fix it

 

SSL Implementation Help

 

Like this post? "Like" it again over there >

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...