matrix2223 Posted April 27, 2006 Posted April 27, 2006 After googling and reading the forums for about 4 hours I stumbled across this bit of information and it works like a charm in the /catalog/includes/application_top.php find this bit of code: // set php_self in the local scope if (!isset($PHP_SELF)) $PHP_SELF = $HTTP_SERVER_VARS['PHP_SELF']; Just after that place this bit of code: if ($PHP_SELF != $SCRIPT_NAME) { $PHP_SELF = $SCRIPT_NAME.$PHP_SELF; } This bit of code will remove the error cant determine page link from showing in the bootom of the page and you will not get product cant be found either. I hope this helps for the people who cant find the answer that no one seems to know. Well now you do. Enjoy :D
matrix2223 Posted April 27, 2006 Author Posted April 27, 2006 O almost forgot to mention, this also works for people who use a host company with shared SSL and a one click osC install.
boxtel Posted April 28, 2006 Posted April 28, 2006 O almost forgot to mention, this also works for people who use a host company with shared SSL and a one click osC install. well, it is known that some servers running in cgi mode can have troubles with $PHP_SELF. on another note (from php.net): Warning: $_SERVER['PHP_SELF'] can include arbitrary user input. The documentation should be updated to reflect this. The request "http://example.com/info.php/attack%20here" will run /info.php, but in Apache $_SERVER['PHP_SELF'] will equal "/info.php/attack here". This is a feature, but it means that PHP_SELF must be treated as user input. The attack string could contain urlencoded HTML and JavaScript (cross-site scripting) or it could contain urlencoded linebreaks (HTTP response-splitting). The use of $_SERVER['SCRIPT_NAME'] is recommended instead. but why you concatenate script_name with php_self as in $SCRIPT_NAME.$PHP_SELF is beyond me. I would simply say : $PHP_SELF = $_SERVER['PHP_SELF'] = $_SERVER['SCRIPT_NAME']; Treasurer MFC
matrix2223 Posted April 28, 2006 Author Posted April 28, 2006 All I know is that it works for me and the only reason why I posted it here is because lots of people have this problem and no one would give an answer. If this is easier $PHP_SELF = $_SERVER['PHP_SELF'] = $_SERVER['SCRIPT_NAME']; then why wouldnt anyone else say this and if I remember correctly I asked this same ? about fixing the problem and everyone just said Turn it off. I didnt want to turn it off. I wanted to fix the problem. So, now it is fixed. all urls are / instead of ?,= The only thing is if this is wrong or whatever why didnt someone else give a solution to the problem instead of Turn it off. I am a firm believer that Google doesnt index past my first page because of this. Yahoo, msn and others dont care. But like I said what ever works Eric
boxtel Posted April 28, 2006 Posted April 28, 2006 All I know is that it works for me and the only reason why I posted it here is because lots of people have this problem and no one would give an answer. If this is easier $PHP_SELF = $_SERVER['PHP_SELF'] = $_SERVER['SCRIPT_NAME']; then why wouldnt anyone else say this and if I remember correctly I asked this same ? about fixing the problem and everyone just said Turn it off. I didnt want to turn it off. I wanted to fix the problem. So, now it is fixed. all urls are / instead of ?,= The only thing is if this is wrong or whatever why didnt someone else give a solution to the problem instead of Turn it off. I am a firm believer that Google doesnt index past my first page because of this. Yahoo, msn and others dont care. But like I said what ever works Eric well, I would first verify if you have this problem or you are just fooling yourself with the notion that "it has not happend since I changed it so I solved it". So I would print these variables side by side for a week in your errorlog to see if they differ and to what extend. I still think turning it off is still the better option if indexing is what you are worried about. Google, MSN and all the others have NO problems whatsoever reading ? and & parameters in your url's. So if you think that turning those into / dividers will solve your problem with indexing you are fooling yourself. Treasurer MFC
matrix2223 Posted April 28, 2006 Author Posted April 28, 2006 Ok I did have the problem with the Unable to determin page link I have had this problem for awhile now. I searched and searched here within the forums and found no answer. Googled for awhile then I came across this code. Which fixed the problem now my pages display with no errors. As far as SEs go everyone of them index my site just fine but Google. Google only indexs my main page and thats it. I have no idea what Im doing wrong but I figured this would help. My page rank with google is a 2 right now. But like I said I have no idea what I am doin wrong. Content, links dont know I just wanted to share with the rest of the people who wanted to know the answer.
boxtel Posted April 28, 2006 Posted April 28, 2006 Ok I did have the problem with the Unable to determin page link I have had this problem for awhile now. I searched and searched here within the forums and found no answer. Googled for awhile then I came across this code. Which fixed the problem now my pages display with no errors. As far as SEs go everyone of them index my site just fine but Google. Google only indexs my main page and thats it. I have no idea what Im doing wrong but I figured this would help. My page rank with google is a 2 right now. But like I said I have no idea what I am doin wrong. Content, links dont know I just wanted to share with the rest of the people who wanted to know the answer. well, fair enough but at least do not concatenate the two variables as that makes no sense. they are supposed to be the same and if php_self does get empty for some reason then use script_name. with your code now that works fine if (and only if) they are not equal AND php_self is empty or script_name is empty. If in the future your host changes stuff and they are still not equal but php_self and script_name are not empty, you are in trouble. Treasurer MFC
matrix2223 Posted April 28, 2006 Author Posted April 28, 2006 So basically what ur tryin to tell me is that I should change this if ($PHP_SELF != $SCRIPT_NAME) { $PHP_SELF = $SCRIPT_NAME.$PHP_SELF; } To this $PHP_SELF = $_SERVER['PHP_SELF'] = $_SERVER['SCRIPT_NAME']; This wont cause any problems with what I got already
matrix2223 Posted April 28, 2006 Author Posted April 28, 2006 Ok I changed it to say the following // set php_self in the local scope if (!isset($PHP_SELF)) $PHP_SELF = $HTTP_SERVER_VARS['PHP_SELF']; $PHP_SELF = $_SERVER['PHP_SELF'] = $_SERVER['SCRIPT_NAME']; I had to take out the } for a parse error Also my pages load a lot faster Hey thanks for the input now the rest of the folks here know. Thanks Boxtel Eric
boxtel Posted April 28, 2006 Posted April 28, 2006 Ok I changed it to say the following // set php_self in the local scope if (!isset($PHP_SELF)) $PHP_SELF = $HTTP_SERVER_VARS['PHP_SELF']; $PHP_SELF = $_SERVER['PHP_SELF'] = $_SERVER['SCRIPT_NAME']; I had to take out the } for a parse error Also my pages load a lot faster Hey thanks for the input now the rest of the folks here know. Thanks Boxtel Eric just this is enough actually: $PHP_SELF = $_SERVER['PHP_SELF'] = $_SERVER['SCRIPT_NAME']; Treasurer MFC
matrix2223 Posted April 28, 2006 Author Posted April 28, 2006 so what you are saying is skip the first line and keep the second line. I think I may keep it this way Im on a cable connection and my pages are loading in less than a second. Thanks Eric
jammin1911 Posted May 3, 2006 Posted May 3, 2006 excellent discussion i had this exact problem and (almost) everything is solved... and the second variation of code definitely helped the page load speeds!! one problem.. when I use the search I am still seeing that darn error: Error! Unable to determine the page link! see example... search for "240sx" on the following page: http://midwestpd.com/catalog/advanced_sear...561fd527d062115 you will see the error.. any help is appreciated!! thanks!
matrix2223 Posted May 3, 2006 Author Posted May 3, 2006 If you only added the $PHP_SELF = $_SERVER['PHP_SELF'] = $_SERVER['SCRIPT_NAME']; and deleted everything else add back if (!isset($PHP_SELF)) $PHP_SELF = $HTTP_SERVER_VARS['PHP_SELF']; // set php_self in the local scope if (!isset($PHP_SELF)) $PHP_SELF = $HTTP_SERVER_VARS['PHP_SELF']; $PHP_SELF = $_SERVER['PHP_SELF'] = $_SERVER['SCRIPT_NAME']; so you should have this I hope this helps
boxtel Posted May 3, 2006 Posted May 3, 2006 If you only added the $PHP_SELF = $_SERVER['PHP_SELF'] = $_SERVER['SCRIPT_NAME']; and deleted everything else add back if (!isset($PHP_SELF)) $PHP_SELF = $HTTP_SERVER_VARS['PHP_SELF']; // set php_self in the local scope if (!isset($PHP_SELF)) $PHP_SELF = $HTTP_SERVER_VARS['PHP_SELF']; $PHP_SELF = $_SERVER['PHP_SELF'] = $_SERVER['SCRIPT_NAME']; so you should have this I hope this helps that will not help. if you read carefully you will see that this is what the code does: 1) make $PHP_SELF equal to $HTTP_SERVER_VARS['PHP_SELF'] if $PHP_SELF is not set 2) make $_SERVER['PHP_SELF'] equal to $_SERVER['SCRIPT_NAME'] always 3) make $PHP_SELF equal to $_SERVER['PHP_SELF'] always so step 1 really is redundant here. there are 2 situations for Unable to determine the page link! to appear: 1) the page given to tep_href_link is empty 2) the request type is not 'NONSSL' and not 'SSL' this $PHP_SELF problem (it being not set) might be the reason for situation 1 and this code might solve that but situation 2 may also happen and that depends on the correct management of the $request_type variable. Treasurer MFC
jammin1911 Posted May 3, 2006 Posted May 3, 2006 so to put it bluntly.. there is no solution as of now? :) this is that whole section where the code was added/changed: // set php_self in the local scope if (!isset($PHP_SELF)) $PHP_SELF = $HTTP_SERVER_VARS['PHP_SELF']; $PHP_SELF = $_SERVER['PHP_SELF'] = $_SERVER['SCRIPT_NAME']; if ($request_type == 'NONSSL') { define('DIR_WS_CATALOG', DIR_WS_HTTP_CATALOG); } else { define('DIR_WS_CATALOG', DIR_WS_HTTPS_CATALOG); } like I said.. this fixed the problem with the catalog but when I search I still see the problem... as described above. thanks guys!
boxtel Posted May 4, 2006 Posted May 4, 2006 so to put it bluntly.. there is no solution as of now? :) this is that whole section where the code was added/changed: // set php_self in the local scope if (!isset($PHP_SELF)) $PHP_SELF = $HTTP_SERVER_VARS['PHP_SELF']; $PHP_SELF = $_SERVER['PHP_SELF'] = $_SERVER['SCRIPT_NAME']; if ($request_type == 'NONSSL') { define('DIR_WS_CATALOG', DIR_WS_HTTP_CATALOG); } else { define('DIR_WS_CATALOG', DIR_WS_HTTPS_CATALOG); } like I said.. this fixed the problem with the catalog but when I search I still see the problem... as described above. thanks guys! well, that depends, that message appears when the page parameter is empty. that does not necessarily have to be $PHP_SELF. if you use a link like : tep_href_link(MY_PAGE_CONSTANT); and that constant is not defined, you get the same result. so check where it happens and what the parameter is you are passing to the function. in addition, when it is working, NEVER use die on a production website, simply ignore the link as it produces error messages on-screen no user can handle and ends the script. Treasurer MFC
jammin1911 Posted May 4, 2006 Posted May 4, 2006 well, that depends, that message appears when the page parameter is empty.that does not necessarily have to be $PHP_SELF. if you use a link like : tep_href_link(MY_PAGE_CONSTANT); and that constant is not defined, you get the same result. so check where it happens and what the parameter is you are passing to the function. in addition, when it is working, NEVER use die on a production website, simply ignore the link as it produces error messages on-screen no user can handle and ends the script. i may not be following 100% but it happends when i search for anything, with any options. ANY search using the osCommerce search function produces a page with no results shown (although it says there are x of x results being displayed depending on what i search for) and then the error at the bottom of the page.. i pasted a direct link to the search page above if you care to see what i mean
boxtel Posted May 4, 2006 Posted May 4, 2006 i may not be following 100% but it happends when i search for anything, with any options. ANY search using the osCommerce search function produces a page with no results shown (although it says there are x of x results being displayed depending on what i search for) and then the error at the bottom of the page.. i pasted a direct link to the search page above if you care to see what i mean yes, I see that link, but as long as you keep the die statements in the tep_href_link function of html_output.php there is no way of knowing which link it was trying to make. That error is surely related to why you get no results. I would, at least for testing, comment out those die statements. Treasurer MFC
selmaboyd Posted May 4, 2006 Posted May 4, 2006 yes, I see that link, but as long as you keep the die statements in the tep_href_link function of html_output.php there is no way of knowing which link it was trying to make. That error is surely related to why you get no results. I would, at least for testing, comment out those die statements. I just had this same problem, and thankfully my hosting company does help me out with my osc problems because sometimes its hard to get help on here. I really appreciate that you took the time to post this solution. I know it would have been helpful to me because I got the same error and I basically had my host company search through the osc files to find it and fix it to me. I LOVE APLUS.NET!!!! and you are right, if you have shared ssl or one click osc install [aplus has a one click osc install...sweet!] you will run into that problem and you will pull your hair out trying to google this site to find answers. Kudos to you for being so thoughtful to help others out with this error!
matrix2223 Posted May 4, 2006 Author Posted May 4, 2006 If some know the answer to sovle the whole problem other than what is posted then PLEASE post it There is lots and lots of people who need this info. What I and boxtel posted works for me and may not work for you. Therefore this is why I am saying that if someone knows how to cure this issue 100% than please post it. This is extremely valuable to alot of people. Thank you, Eric
jammin1911 Posted May 8, 2006 Posted May 8, 2006 well we commented out those die statements and it seems to work perfectly now, thanks a lot! should there be any negative effects to leaving it this way? we've notice another problem now, we havent had a single order online since migrating to this new host so we went through the process ourselves and it.. 'sort of' works. often when trying to log in it will 404... but then usually when i try again it works.. this is the same for all accounts. i was able to go through the process after succesfully logging in and placing an order but I think this is scaring off customers when they see the error and they dont even try a second time.. it's strange though because now that it's worked once, it works all the time for me.. but if i go to a differnt system it will 404 the first attempt and then work after... and it keeps working first shot with different accounts.. pretty strange. any input on this? this is the worst problem yet -- orders are the most important part!! :) thanks again for all of the help everyone
matrix2223 Posted May 8, 2006 Author Posted May 8, 2006 I noticed that when one uses the search box that if a customer doesnt type a specific product ie dvd then you get the no product returned. I also found that if you have the ability to use Chemos Ultimate seo urls which uses .htaccess with mod rewrite, it works like a charm. If you cant use this contrib use his first attempt which still works called cName pName which uses a php based function to rewrite the urls. I have also installed this one and it works. All have been used on a test site only basis. I havent tried the commenting out the die statements because in the cName contrib it changes this to where it happens a few more lines down. But like I said earlier someone in this here forum knows the 100% answer for this cure and they aint sayin. Its a same that a rookie like myself has to go and figure it out on my own. I switched host since I first posted this easy to fix solution and my new host supports .htaccess and mod rewrites. I am currently using the above posted code with Ultimate SEO URLs and I have yet to find anything wrong. I only wish that someone smarter than I would post the solution to cure it once and for all. For everyone!! Eric
jammin1911 Posted May 9, 2006 Posted May 9, 2006 Ultimate SEO URLs could you explain this in more detail? I'm not sure what this is and we really need this site working.. i'm getting desperate :P
matrix2223 Posted May 9, 2006 Author Posted May 9, 2006 Ultimate SEO URLs combines php files and a .htaccess file that has mod rewrite functions for apache web servers. Im not sure if a microsoft server can handle .htaccess files. Which in most cases microsoft cant handle much of anything but thats a different subject. Look in you catalog directory for a .htaccess file or root directory depending where you have your catalog at. My old host used a .ISREADY file or something like that. They didnt support .htaccess to the extent that I needed. So I switched hosts. But anyways there is serveral contribs out there that use a rewrite function for the url the onlyl one that does it strictly php based is the cName pName contrib by the great Chemo. There are others out there that only uses an .htaccess file for the rewrite rule and then there are some like ultimate seo urls that uses php files and .htaccess. I use ultimate seo urls it makes the url look like this http://myshop.com/dvd-blade.html notice the html extension this is supposly great for google after I added this contrib my page rank went from 0 to 2 in two days. There is so much about seo stuff it would be better to just pm me or email me. Hope this helps Eric
txmanu Posted September 23, 2006 Posted September 23, 2006 After googling and reading the forums for about 4 hours I stumbled across this bit of information and it works like a charm in the /catalog/includes/application_top.php find this bit of code: // set php_self in the local scope if (!isset($PHP_SELF)) $PHP_SELF = $HTTP_SERVER_VARS['PHP_SELF']; Just after that place this bit of code: if ($PHP_SELF != $SCRIPT_NAME) { $PHP_SELF = $SCRIPT_NAME.$PHP_SELF; } This bit of code will remove the error cant determine page link from showing in the bootom of the page and you will not get product cant be found either. I hope this helps for the people who cant find the answer that no one seems to know. Well now you do. Enjoy :D I spent many hours here trying to figure out this problem, all I could find was the "search friendly url" stuff, and a line for the .htaccess file. When I found this post and tried your code change the error finally went away. Of course I don't know how it will work in the long run, but for now I'm happy. Thanks! Manuela
Recommended Posts
Archived
This topic is now archived and is closed to further replies.