Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Unable to determine the page link?


casch

Recommended Posts

:?:

 

Hi Folks,

could not find any topics on this problem. I downloaded the complete oscommerce-zip-file and unzipped it. After creating the mysql-database and the tables i tried to open the shop in the browser --> http://localhost/catalog/default.php

 

The page opens but at the bottom appears an error: "Unable to determine the page link!" As far as i understand this error appears if the variable $page is empty. Any link that is clicked opens the same page default.php including the error-message.

 

Does anybody understand the mistake i have made?

 

Any help would be appreciated!

 

Carsten

Link to comment
Share on other sites

  • Replies 76
  • Created
  • Last Reply

Well, I read many of the posts for "Unable to determine the page link"

 

and most reccommend using 2.2 than 2.1...

 

Anyway, I am already using 2.1, and I have fixed the problem.

 

The problem wasn't oscommerce rather PHP 4.3

 

It was return empty string for the php variable $PHP_SELF

 

So, all I had to do was : in function tep_href_link of general.php (include/functions) , add the following line at the very top

 

global $HTTP_SERVER_VARS;

if($page='')

$HTTP_SERVER_VARS['PHP_SELF']

 

That has solved the problem.

Link to comment
Share on other sites

Error

Unable to determine the page link!

Hmm well i've been having the error during checking after choosing payment method. This problems starting with PHP 4.3.0. I tried to put what you said in the top of general.php, inside the php code, and the page doesn't load.

 

I've been watching this thread where they seem to be tracing the problem: http://www.oscommerce.com/forums/viewtopic.php...p=105407#105407

 

But nothing so far.

 

Ryan

Link to comment
Share on other sites

It may all boil down to your system and config. I just got it to work properly and here is my config:

 

Apple MacOSX Darwin 10.2

Apache 1.37

PHP 4.2.2

oscommerce 2.1

register_global = on

session_auto_start = off

use cookies for session = on

 

That error message

Error

Unable to determine the page link!

 

comes from tep_href_link of general.php. And by looking at the if condition, u shouldn't have any problem noticing that it happens becuase of $page=''

 

And if you bother to trace the source of it - u will see that in most cases the call was tep_href_link(basename($PHP_SELF) ......

 

 

Hope that helps..

 

[/code]

Link to comment
Share on other sites

I guess I don't know enough about PHP. The problem begin with the new 4.3.0. The team members blame a change with the new 4.3.0. Can you explain again what code changes I need to make? I pasted your code into the top of general.php, but it made the whole site not work - blank.

 

The problem Im having seems to happen with the gift voucher mod.

Ryan

Link to comment
Share on other sites

And what did you mean:

So, all I had to do was : in function tep_href_link of general.php.--- What do I do with tep_href_link?

 

Ryan

 

So, all I had to do was : in function tep_href_link of general.php (include/functions) , add the following line at the very top

 

global $HTTP_SERVER_VARS;

if($page='')

$HTTP_SERVER_VARS['PHP_SELF']

 

Reread what he posted - amazing how so many people don't read the message and follow the instructions.

 

IN the FUNCTION tep_href_link which is found in the file general.php, add the above code to the top of that function called tep_href_link -- I guess simon could/should have provided before and after code snippits...

Link to comment
Share on other sites

Yes, still not sure where to put that code. The previous poster made it sound like the code needed to be in a seperate file, tep_href_link. I don't have anything like that in my functions folder so now im real confused. Im running OSC 2.2.

Ryan

Link to comment
Share on other sites

On includes/function/general.php

 

go to like 24.

 

See how it has the function tep_href_link ???

 

on line 27 to 29, u will see the that :

 

if ($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>');

   }

 

Replace this with :

   if($page == ''){

       $page = basename($HTTP_SERVER_VARS['PHP_SELF']);

}

 

 

On line 25 you have :

 

        global $link;

 

 

make it

 

        global $link, $HTTP_SERVER_VARS;

 

Note that this is osCommerce 2.1 code that I am talking about.

 

Hope that helps.

 

simon

Link to comment
Share on other sites

global $HTTP_SERVER_VARS;  

if($page='')  

$HTTP_SERVER_VARS['PHP_SELF']  

 

But that wouldn't do anything that I can tell. That if statement would always evaluate to true because you're assigning the empty string to the variable $page. The line inside the if statement does nothing outside of looking up that variable - it doesn't assign it or use it in any way.

 

Maybe if you did this:

global $HTTP_SERVER_VARS;

if( $page == '' ) $page = $HTTP_SERVER_VARS[ 'PHP_SELF' ];

 

But it's not an occurance of $PHP_SELF that's causing the problem. I replaced all instances with $_SERVER[ 'PHP_SELF' ];

 

Though I did find a bug that was probably fixed after my snapshot (an old ass August snapshot): There were instances of $_SERVER[ 'php_self' ] (lowercase 'php_self') which evaluated to blank strings or null. This occurred after an order was processed and the Continue button was clicked (and the action was 'notify'). Changing it to all caps fixed 'PHP_SELF' *that* problem....

 

Too bad it didn't fix this main problem.

 

-chicken

Link to comment
Share on other sites

If you have PHP4.1.0+ here's a suggestion that might be even better than simon's suggestion:

 

Just change the function definition from this:

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

 

to this:

 

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

 

That will just set $page to $_SERVER[ 'PHP_SELF' ] if it's not set to something else when the function is called. No need to declare any variables (HTTP_SERVER_VARS) global or anything.

 

There is a concern about defaulting $page to php_self of course - what if there's a redirect that isn't receiving a page reference and just keeps pointing to itself. It will generate a message (at least in IE) something along the lines of 'The page request reached it's maximum redirect blah blah blah'.

 

-chicken

Link to comment
Share on other sites

Interesting.

 

To begin with, I'm having the same problem as sabotage (the unable to determine page link when coming to the checkout_confirmation caused by PHP 4.3.0).

 

I implemented simon's code (using $_SERVER instead of having to global $HTTP_SERVER_VARS).

 

I'm now able to get past the 'Unable to determine page link' error, but now I get the next error in tep_href_link 'Unable to determine connection method. Known methods are NONSSL SSL'.

 

So I echoed out $connection and it's set to /checkout_confirmation.php! Is that weird or what?! Also, strlen($connection) returns 0???

 

I'll keep looking....

 

-chicken

Link to comment
Share on other sites

Oh, all of this is already assuming you have register_globals = on. That's not the issue here.

 

This was caused when my hosting company (and same with the two others that are having the same problem) upgraded to PHP 4.3.0.

 

Something very strange is going on.

Link to comment
Share on other sites

In another thread on the same topic it was mentioned htere is a patch for the PHP_Self problem with 4.3. Has your host already applied the patch?

Link to comment
Share on other sites

This is really just bizarre.

 

It's not an issue of PHP_SELF. I replaced all occurences with $_SERVER[ 'PHP_SELF' ] and received same error message.

 

I modified tep_href_link to default to php_self instead of displaying an error message if $page = ''. That got past that error message, but popped up the next possible error in tep_href_link: the $connection being blank (something like 'Unable to determine connection. Known values are NONSSL SSL'). So I echoed out $connection.

 

.

.

.

.

.

 

Strangest of things: $connection echoed this value: /checkout_confirmation.php

 

!!??!! Anybody have any clue how the arguments could get shifted - for only the first time (since refreshing permanently fixes the problem for that session)??

 

-Chicken

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...