Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

tep_redirect() failing in account.php


technopeasant

Recommended Posts

Hi there,

 

I am working away on my oscommerce site and decided to test all of the links. Fortunately, I started testing 24 hours before the site goes live because, unfortunately, I discovered a big problem. Namely, my account.php page does not redirect to the secure login.php page. After some debugging, I have come to the conclusion that tep_redirect() is not working properly when redirecting to my secure server e.g. https:/my site/login.php . (However, if I cut and paste the https url into a web browser, the secure site is found.)

 

I have pared down the account.php page for testing. Here are the contents of the failing page:

<?php

/*

$Id: account.php,v 1.61 2003/06/09 23:03:52 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

require('includes/application_top.php');

 

if (!tep_session_is_registered('customer_id')) {

$navigation->set_snapshot();

tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));

}

 

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_ACCOUNT);

 

$breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_ACCOUNT, '', 'SSL'));

?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html <?php echo HTML_PARAMS; ?>>

<head>

 

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

<title><?php echo TITLE; ?></title>

</head>

<body>

<p><?php echo FILENAME_LOGIN; ?> </p>

<p><?php echo HTTPS_SERVER; ?>HTTPS_SERVER </p>

<p><?php echo $url; ?> </p>

 

</body>

</html>

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

The above results in a blank page :(. The HTML of which is:

<html>

<head>

<meta http-equiv="content-type" content="text/html;charset=utf-8"/>

<meta http-equiv="content-type" content="text/html;charset=utf-8"/>

</head>

<body/>

</html>

Way less than what I was expecting.

 

My test page that produces results:

<?php

/*

$Id: account.php,v 1.61 2003/06/09 23:03:52 hpdl Exp $

 

osCommerce, Open Source E-Commerce Solutions

 

Copyright © 2003 osCommerce

 

Released under the GNU General Public License

*/

 

require('includes/application_top.php');

 

if (!tep_session_is_registered('customer_id')) {

$navigation->set_snapshot();

$url = tep_href_link(FILENAME_LOGIN, '', 'SSL');

// tep_redirect(tep_href_link(FILENAME_LOGIN, '', 'SSL'));

}

 

require(DIR_WS_LANGUAGES . $language . '/' . FILENAME_ACCOUNT);

 

$breadcrumb->add(NAVBAR_TITLE, tep_href_link(FILENAME_ACCOUNT, '', 'SSL'));

?>

<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">

<html <?php echo HTML_PARAMS; ?>>

<head>

 

<meta http-equiv="Content-Type" content="text/html; charset=<?php echo CHARSET; ?>">

<title><?php echo TITLE; ?></title>

</head>

<body>

<p><?php echo FILENAME_LOGIN; ?> </p>

<p><?php echo HTTPS_SERVER; ?>HTTPS_SERVER </p>

<p><?php echo $url; ?> </p>

 

</body>

</html>

<?php require(DIR_WS_INCLUDES . 'application_bottom.php'); ?>

 

Output from the above

<html dir="LTR" lang="en">

<head>

<meta http-equiv="content-type" content="text/html;charset=utf-8"/>

<meta http-equiv="content-type" content="text/html;charset=utf-8"/>

<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"/>

<title>Bad Girls</title>

</head>

<body>

<p>login.php </p>

<p>
</p>

<span class="smallText">Parse Time: 0.675s</span>

</body>

</html>

 

My <home>/includes/functions/general.php has not changed. So... I was wondering if any of you had experienced a similar mishap with their site and could give me a few clues as to where I went wrong.

Thanks!

 

Techno peasant

Link to comment
Share on other sites

Thanks mirk0oo7. Your reply pointed me in the right direction.

 

Fortunately I had made a backup of all php pages not too long ago.

After some trouble shooting, I discovered that I had accidentally added a meta tag before the

<?php

in the following files.

<my shop home>/includes/configure.php

<my shop home>/includes/languages/english.php

 

It looked like this:

<meta http-equiv="content-type" content="text/html;charset=utf-8">
<?php
...
?>

 

I remember being prompted and accepting the meta tags by "Adobe GoLive". If only I had realized the consequences!!! Ah well, back to vim :)

tp

Link to comment
Share on other sites

I remember being prompted and accepting the meta tags by "Adobe GoLive". If only I had realized the consequences!!! Ah well, back to vim :)

tp

ps removing the meta tags from those files resolved the problem. Now, back to work :)

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...