Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

What is the osCsid & why you must not loose it.


spooks

Recommended Posts

 

 

As detailed b4, the robots must never see the sid, you must enable Prevent Spider Sessions and update spiders.txt http://addons.oscommerce.com/info/2455

 

so sid in url is inconsequential to seo

 

 

I do have prevent spider sessions set to true, and i am uploading the updated spiders.txt file now..

 

After doing this, i assume my URLs will still have the OscID, but the the spiders will still be able to find the pages and just not grab the OSCID? that would work for me...

 

readme confirms this... excellent! anyway to test its working properly?

Link to comment
Share on other sites

  • Replies 206
  • Created
  • Last Reply

I do have prevent spider sessions set to true, and i am uploading the updated spiders.txt file now..

 

After doing this, i assume my URLs will still have the OscID, but the the spiders will still be able to find the pages and just not grab the OSCID? that would work for me...

 

readme confirms this... excellent! anyway to test its working properly?

 

 

Just look up on spoofing the user agent in your browser, then visit your site with that. smile.gif

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

  • 2 weeks later...

What is the osCsid & why you must not loose it....

 

Equally when a user is on the site osC needs to ensure the users sid is kept throughout the visit, as if it is lost at any time the application will consider they are a new visitor, so they would loose the cart content, suddenly find their logged out again or even get lost halfway through checkout!!

 

This is what I was doing, I had text and image links on my index.php page pointing my html link to pages and or catetories in an effort to help the customer quickly find seasonal products or items I wanted to feature.

 

Using the technique of closing the browsers and going to my site I could see the osCsid on links such as in the categories box or the recently added box when I hovered the mouse cursor over them, but NOT on my links within the body portion of the page. Lesson learned and thank you for bringing this matter forward.

 

What is the osCsid & why you must not loose it....

........

osC keeps the users sid between pages through use of the tep_href_link function, so all links must use tep_href_link to ensure the sid remains, you can circumvent this issue with 'Force Cookie Use' where since the sid is stored within the cookie if it is lost through any 'bad' code it can be picked up from there again.

 

My struggle, and this is because I have yet to delve deeply into php coding is the appropriate syntax to use with the tep_href_link.

 

I read through the references, and have a better grasp of what's going on here now. Seeing this...

 

.......

If your writing your own code, the details for the tep_href_link function are:

 

tep_href_link($page, $parameters , $connection, $add_session_id , $search_engine_safe )

 

$page is the page you are linking to.

$parameters is parameters for the url (action=send etc)

$connection is SSL or NONSSL

$add_session_id is normally 'true' so sid is added

$search_engine_safe if set to true and SEARCH_ENGINE_FRIENDLY_URLS is set to 'true' (in admin) sef url's are created.

 

I believe I understand what the function wants but after many trys I can't get it correct. When I load my page I get the error message that my syntax is not correct perhaps with an ',",: or whatever character.

 

What I need help with is properly formating the tep_href_link. I am trying to embed the link in the body of my includes/languages/english/index.php page. Noting the entire page is within the <?php - ?> indicators I was placing the tep_href_link function within a table I have there.

 

Please help with the proper code layout for both text and image linking? I've googled galore and just can't seem to find what I am looking for.

 

Thanks

I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

Link to comment
Share on other sites

 

 

As you havent included your code I cant be precise, but you are adding code to a language file, ie a define, that means you must escape all reserved chars.

 

ie instead of ' you must put \' (\ is the escape character).

 

 

 

PS there is another method if you care to look. smile.gif

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

As you havent included your code I cant be precise, but you are adding code to a language file, ie a define, that means you must escape all reserved chars.

 

ie instead of ' you must put \' (\ is the escape character).

 

 

 

PS there is another method if you care to look. smile.gif

 

If I put down every permutation of code I tried, I'd probably melt down the osC server. :) But yes....the escape character. In my limited knowledge of PHP, that's one aspect I did read about before. Should have thought about that. Rats. So giving it a try.

 

Regards the other mysterious method, keep that handy I might get desperate.

 

Thanks

I am not a professional webmaster or PHP coder by background or training but I will try to help as best I can.

I remember what it was like when I first started with osC. It can be overwhelming.

However, I strongly recommend considering hiring a professional for extensive site modifications, site cleaning, etc.

There are several good pros here on osCommerce. Look around, you'll figure out who they are.

Link to comment
Share on other sites

Hi,

I've included the following link to my languages/english/index.php file, line 20

<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'cPath=24&products_id=60') . '"><img src="http://img1.site.com/img/extras/image.jpg" title="Click to see image!" alt="Click here" width="362" height="202" border="0"></a>

All seeems to be working fine, I can click the image, no errors on the page, the product exists, etc. However when I look in my error_log, I see this:

[15-Dec-2009 01:50:33] PHP Fatal error:  Call to undefined function  tep_href_link() in /home/mystore/public_html/includes/languages/english/index.php on line 20

 

Any ideas please?

Absinthe Original Liquor Store

Link to comment
Share on other sites

Hi,

I've included the following link to my languages/english/index.php file, line 20

<a href="' . tep_href_link(FILENAME_PRODUCT_INFO, 'cPath=24&products_id=60') . '"><img src="http://img1.site.com/img/extras/image.jpg" title="Click to see image!" alt="Click here" width="362" height="202" border="0"></a>

All seeems to be working fine, I can click the image, no errors on the page, the product exists, etc. However when I look in my error_log, I see this:

[15-Dec-2009 01:50:33] PHP Fatal error:  Call to undefined function  tep_href_link() in /home/mystore/public_html/includes/languages/english/index.php on line 20

 

Any ideas please?

 

 

because the language file is being called b4 the function is defined.

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

because the language file is being called b4 the function is defined.

Thank you for your swift reply, much appreciated. What would be the solution to the problem? The

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

is located above the <head>, however the

<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">

is in the <head> ( I believe that it is THE function...

Absinthe Original Liquor Store

Link to comment
Share on other sites

Thank you for your swift reply, much appreciated. What would be the solution to the problem? The

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

is located above the <head>, however the

<base href="<?php echo (($request_type == 'SSL') ? HTTPS_SERVER : HTTP_SERVER) . DIR_WS_CATALOG; ?>">

is in the <head> ( I believe that it is THE function...

 

 

ensure you call application top first.

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

Nobody is answering because your scenario is essentially impossible .. I'll explain.

 

application_top.php is included before all other files .. in RC2a html_output.php is included on line 119 of application_top.php and the function tep_href_link() is defined in html_output.php.

 

The only way for tep_href_link() to be undefined when ..

 

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

 

is called would be if application_top.php hadn't been included before it .. in this case though the entire page would fail.

Link to comment
Share on other sites

Application top is being called first, before the language file.

Thank you Robert for jumping in... is there any possible solution? Or does it mean that we cannot have tep_href_link in index.php at all?

 

Do you have one error report or loads of them .. perhaps you by mistake commented out application_top for a few minutes or something. If the error was persistent you would have the error repeated for every page load of index.php.

 

Perhaps there is no longer an error, as I said with your site still loading it is impossible.

Link to comment
Share on other sites

Do you have one error report or loads of them .. perhaps you by mistake commented out application_top for a few minutes or something. If the error was persistent you would have the error repeated for every page load of index.php.

 

Perhaps there is no longer an error, as I said with your site still loading it is impossible.

I have a loads of them and for every language.... however these errors are in the error_log files only - none visible on the site nor causing any failures. I could ignore them if those were warnings only but since they're fatal, I wanted to get rid of them. Any solution will be appreciated - I've been searching threads for days but to no avail. There is also another fatal error being recorded:

PHP Fatal error:  Call to undefined function  tep_session_save_path() in /home/mystore/public_html/includes/languages/english.php on line 362

the line 362 reads

Warning: The sessions directory does not exist: ' . tep_session_save_path() . '. Sessions will not work until this directory is created.

Absinthe Original Liquor Store

Link to comment
Share on other sites

I have a loads of them and for every language.... however these errors are in the error_log files only - none visible on the site nor causing any failures. I could ignore them if those were warnings only but since they're fatal, I wanted to get rid of them. Any solution will be appreciated - I've been searching threads for days but to no avail. There is also another fatal error being recorded:

PHP Fatal error:  Call to undefined function  tep_session_save_path() in /home/mystore/public_html/includes/languages/english.php on line 362

the line 362 reads

Warning: The sessions directory does not exist: ' . tep_session_save_path() . '. Sessions will not work until this directory is created.

 

what error_reporting do you have in application_top.php? (near the top).

Link to comment
Share on other sites

  error_reporting(E_ALL & ~E_NOTICE);

 

 

is it possible that you uploaded your admin application_top to your shop side?

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

is it possible that you uploaded your admin application_top to your shop side?

Everything is possible but I doubt it, this is in my shop application_top for example:

$cookie_domain = (($request_type == 'NONSSL') ? HTTP_COOKIE_DOMAIN : HTTPS_COOKIE_DOMAIN);
or
define('PHP_SESSION_NAME', 'osCsid');

Absinthe Original Liquor Store

Link to comment
Share on other sites

  • 3 weeks later...

Rob, Sam, any ideas on the above please?

 

Basically it is impossible for this to happen if application_top.php has been called .. sooo ..

 

you must have a file somewhere that is calling the language file but NOT calling application_top.php, a cron file perhaps?

Link to comment
Share on other sites

No, not as far as I can tell. No cron is calling the home (index.php) page where the link is. The error is recorded as soon as you visit a page with the link. The link on index page is standard:

<a href="' . tep_href_link(FILENAME_LOYALTY) . '" title="some title"><u>some text</u></a>

But it is not just the link that I've created in the index file, another example of the fatal error being recorded:

PHP Fatal error:  Call to undefined function  tep_session_save_path() in /home/mystore/public_html/includes/languages/english.php on line 362

the line 362 reads

Warning: The sessions directory does not exist: ' . tep_session_save_path() . '. Sessions will not work until this directory is created.

Absinthe Original Liquor Store

Link to comment
Share on other sites

No, not as far as I can tell. No cron is calling the home (index.php) page where the link is. The error is recorded as soon as you visit a page with the link. The link on index page is standard:

<a href="' . tep_href_link(FILENAME_LOYALTY) . '" title="some title"><u>some text</u></a>

But it is not just the link that I've created in the index file, another example of the fatal error being recorded:

PHP Fatal error:  Call to undefined function  tep_session_save_path() in /home/mystore/public_html/includes/languages/english.php on line 362

the line 362 reads

Warning: The sessions directory does not exist: ' . tep_session_save_path() . '. Sessions will not work until this directory is created.

 

Well it's impossible to debug like this .. if the core functions are not defined then the file has been called before the bootstrap (application_top)

Link to comment
Share on other sites

Thank you anyway, it seems like a mystery at the moment... I have compared three different log files from three language folders and guess what? The times of those errors are almost identical (but different each day)! Look:

[01-Jan-2010 09:54:18] PHP Fatal error:  Call to undefined function  tep_href_link() in /home/m/public_html/includes/languages/english/index.php on line 20
[01-Jan-2010 10:43:59] PHP Fatal error:  Call to undefined function  tep_href_link() in /home/m/public_html/includes/languages/english/index.php on line 20
[02-Jan-2010 18:56:04] PHP Fatal error:  Call to undefined function  tep_href_link() in /home/m/public_html/includes/languages/english/index.php on line 20
[02-Jan-2010 19:44:17] PHP Fatal error:  Call to undefined function  tep_href_link() in /home/m/public_html/includes/languages/english/index.php on line 20
[03-Jan-2010 11:56:04] PHP Fatal error:  Call to undefined function  tep_href_link() in /home/m/public_html/includes/languages/english/index.php on line 20
[03-Jan-2010 13:12:01] PHP Fatal error:  Call to undefined function  tep_href_link() in /home/m/public_html/includes/languages/english/index.php on line 20

[01-Jan-2010 09:55:01] PHP Fatal error:  Call to undefined function  tep_href_link() in /home/m/public_html/includes/languages/espanol/index.php on line 27
[01-Jan-2010 10:44:00] PHP Fatal error:  Call to undefined function  tep_href_link() in /home/m/public_html/includes/languages/espanol/index.php on line 27
[02-Jan-2010 18:56:45] PHP Fatal error:  Call to undefined function  tep_href_link() in /home/m/public_html/includes/languages/espanol/index.php on line 27
[02-Jan-2010 19:44:18] PHP Fatal error:  Call to undefined function  tep_href_link() in /home/m/public_html/includes/languages/espanol/index.php on line 27
[03-Jan-2010 11:57:10] PHP Fatal error:  Call to undefined function  tep_href_link() in /home/m/public_html/includes/languages/espanol/index.php on line 27
[03-Jan-2010 13:12:02] PHP Fatal error:  Call to undefined function  tep_href_link() in /home/m/public_html/includes/languages/espanol/index.php on line 27

[01-Jan-2010 09:54:40] PHP Fatal error:  Call to undefined function  tep_href_link() in /home/m/public_html/includes/languages/french/index.php on line 28
[01-Jan-2010 10:44:01] PHP Fatal error:  Call to undefined function  tep_href_link() in /home/m/public_html/includes/languages/french/index.php on line 28
[02-Jan-2010 18:56:25] PHP Fatal error:  Call to undefined function  tep_href_link() in /home/m/public_html/includes/languages/french/index.php on line 28
[02-Jan-2010 19:44:19] PHP Fatal error:  Call to undefined function  tep_href_link() in /home/m/public_html/includes/languages/french/index.php on line 28
[03-Jan-2010 11:56:41] PHP Fatal error:  Call to undefined function  tep_href_link() in /home/m/public_html/includes/languages/french/index.php on line 28
[03-Jan-2010 13:12:03] PHP Fatal error:  Call to undefined function  tep_href_link() in /home/m/public_html/includes/languages/french/index.php on line 28

Therefore I think that the error cannot be reproduced or caused by visiting the page... what else could be causing it? :sweating:

Absinthe Original Liquor Store

Link to comment
Share on other sites

Thank you anyway, it seems like a mystery at the moment... I have compared three different log files from three language folders and guess what? The times of those errors are almost identical (but different each day)! Look:

[01-Jan-2010 09:54:18] PHP Fatal error:  Call to undefined function  tep_href_link() in /home/m/public_html/includes/languages/english/index.php on line 20
[01-Jan-2010 10:43:59] PHP Fatal error:  Call to undefined function  tep_href_link() in /home/m/public_html/includes/languages/english/index.php on line 20
[02-Jan-2010 18:56:04] PHP Fatal error:  Call to undefined function  tep_href_link() in /home/m/public_html/includes/languages/english/index.php on line 20
[02-Jan-2010 19:44:17] PHP Fatal error:  Call to undefined function  tep_href_link() in /home/m/public_html/includes/languages/english/index.php on line 20
[03-Jan-2010 11:56:04] PHP Fatal error:  Call to undefined function  tep_href_link() in /home/m/public_html/includes/languages/english/index.php on line 20
[03-Jan-2010 13:12:01] PHP Fatal error:  Call to undefined function  tep_href_link() in /home/m/public_html/includes/languages/english/index.php on line 20

[01-Jan-2010 09:55:01] PHP Fatal error:  Call to undefined function  tep_href_link() in /home/m/public_html/includes/languages/espanol/index.php on line 27
[01-Jan-2010 10:44:00] PHP Fatal error:  Call to undefined function  tep_href_link() in /home/m/public_html/includes/languages/espanol/index.php on line 27
[02-Jan-2010 18:56:45] PHP Fatal error:  Call to undefined function  tep_href_link() in /home/m/public_html/includes/languages/espanol/index.php on line 27
[02-Jan-2010 19:44:18] PHP Fatal error:  Call to undefined function  tep_href_link() in /home/m/public_html/includes/languages/espanol/index.php on line 27
[03-Jan-2010 11:57:10] PHP Fatal error:  Call to undefined function  tep_href_link() in /home/m/public_html/includes/languages/espanol/index.php on line 27
[03-Jan-2010 13:12:02] PHP Fatal error:  Call to undefined function  tep_href_link() in /home/m/public_html/includes/languages/espanol/index.php on line 27

[01-Jan-2010 09:54:40] PHP Fatal error:  Call to undefined function  tep_href_link() in /home/m/public_html/includes/languages/french/index.php on line 28
[01-Jan-2010 10:44:01] PHP Fatal error:  Call to undefined function  tep_href_link() in /home/m/public_html/includes/languages/french/index.php on line 28
[02-Jan-2010 18:56:25] PHP Fatal error:  Call to undefined function  tep_href_link() in /home/m/public_html/includes/languages/french/index.php on line 28
[02-Jan-2010 19:44:19] PHP Fatal error:  Call to undefined function  tep_href_link() in /home/m/public_html/includes/languages/french/index.php on line 28
[03-Jan-2010 11:56:41] PHP Fatal error:  Call to undefined function  tep_href_link() in /home/m/public_html/includes/languages/french/index.php on line 28
[03-Jan-2010 13:12:03] PHP Fatal error:  Call to undefined function  tep_href_link() in /home/m/public_html/includes/languages/french/index.php on line 28

Therefore I think that the error cannot be reproduced or caused by visiting the page... what else could be causing it? :sweating:

 

Cron jobs .. browse to the ones you have manually and see if they error out.

Link to comment
Share on other sites

  • 2 weeks later...

Another way you can loose sid is through the use of links to anchors on a page, like

 

<a href="<?php echo tep_href_link(FILENAME_DEFAULT,'action=default#information'); ?>">More Info</a>

 

the trouble with this is should the url contain a sid, the resulting link will be:

 

http://www.domain-one.com/index.php?action...52r43tWEFw34352

 

since the sid occurs after the anchor link its ignored, so sid lost and disaster.

 

The answer is to either don't use anchors, or test for the sid & don't use anchors if it exists.

 

IE at top of page you have

 

$sess_id = (tep_not_null(SID));

 

then the above link would become

 

<a href="<?php echo tep_href_link(FILENAME_DEFAULT,'action=default' . ($sess_id ? '' : '#information')); ?>">More Info</a>

 

I hope thats useful to some. :)

Hmm, why bother with the trouble and not just use:

<a href="<?php echo tep_href_link(FILENAME_DEFAULT,'action=default'); ?>#information">More Info</a>

anchor should always be at the end of any url?

works for me that is.

 

That's actually how I did it from the first time, thought it was logical to not send my anchors through the search engine friendly / oscsid mangling, as the only thing it could do is mess them up, and there is no need for such action to be taken on any anchors whatsoever for as far as I know.

 

and if you agree, please update your second post. If not please let me know what error there is in my mind :)

Link to comment
Share on other sites

 

 

Yes I agree, your solution will work thumbsup.gif , most try doing it the other way though. huh.gif

 

 

Unfortunatly this forum software does not allow you to update old posts!! crying.gif The only way to do that is to send a request to a mod for them to update for you, which is smthg they would only do if there was a special need. sad.gif

Sam

 

Remember, What you think I ment may not be what I thought I ment when I said it.

 

Contributions:

 

Auto Backup your Database, Easy way

 

Multi Images with Fancy Pop-ups, Easy way

 

Products in columns with multi buy etc etc

 

Disable any Category or Product, Easy way

 

Secure & Improve your account pages et al.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...