Jump to content

Archived

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

casch

Unable to determine the page link?

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

Share this post


Link to post
Share on other sites

Yeah...

 

I am having the same problem...

 

By looking at the source code it is only happening in use of the info_box item (for add a quickie)....

 

If I uncomment that, it does not happen.

 

HELP!

Share this post


Link to post
Share on other sites

I just searched for "Unable to determine the page link" using all terms and got 91 results.

 

The question has been asked and answered many times...


This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest Responsive osCommerce CE (community edition) here

Share this post


Link to post
Share on other sites

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.

Share this post


Link to post
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://forums.oscommerce.com/viewtopic.php...p=105407#105407

 

But nothing so far.

 

Ryan

Share this post


Link to post
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]

Share this post


Link to post
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

Share this post


Link to post
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...

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

BTW, I already tried putting it at the top of general.php. Im obiously not following you. A code snipit of where it goes would be very helpful. I've got a fully modified store, so yes I can follow directions. ;)

 

Ryan

Share this post


Link to post
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

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Sorry, somebody (me) needs to read to the end of a post before posting myself. While my response to CatHerder is correct, simon1663 had already posted something similar.

 

-chicken

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Damn, eager beaver chicken needs to test his shite first....

 

Apparently you can't use $_SERVER[ 'PHP_SELF' ] in the definition(?).

 

-chicken, an ass wearing a chicken costume

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

Instead of doing any of this, try setting "register_globals" to on in php.ini

 

You may need to contact your host to do this.


This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest Responsive osCommerce CE (community edition) here

Share this post


Link to post
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.

Share this post


Link to post
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?


Kim

~~~~~~~~~~~~~

Share this post


Link to post
Share on other sites

Are you 100% certain that when your host upgraded, they did change the php.ini ? As the default settings cause these tpyes of errors...


This is a signature that appears on all my posts.  
IF YOU MAKE A POST REQUESTING HELP...please state the exact version
of osCommerce that you are using. THANKS

 
Get the latest Responsive osCommerce CE (community edition) here

Share this post


Link to post
Share on other sites

well, check with phpinfo() first to find out the settings

 

You can always modify the settings using ini_set()...

 

look up this function in php.net

 

ALtough I am not really sure how much php_ini() allows u to change...

Share this post


Link to post
Share on other sites

Where is this patch you mention for PHP 4.3.0? Where can I read more about it? My phpinfo says: register_globals On On

 

I'll keep my eye on this thread, hopefully chicken or someone else will get further into the issue. :cry:

 

Ryan

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

×