Jump to content


Corporate Sponsors


Latest News: (loading..)

* * * * * 4 votes

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


197 replies to this topic

#181 germ

  • Community Member
  • 13,471 posts
  • Real Name:Jim
  • Gender:Male
  • Location:USA (GMT-6)

Posted 06 September 2010, 21:52

Cookie setting are wrong.

For these:

define('HTTP_COOKIE_DOMAIN', 'http://www.survey-templates.com');
define('HTTPS_COOKIE_DOMAIN', 'https://www.survey-templates.com');

Try this:

define('HTTP_COOKIE_DOMAIN', 'www.survey-templates.com');
define('HTTPS_COOKIE_DOMAIN', 'www.survey-templates.com');

or this:

define('HTTP_COOKIE_DOMAIN', '.survey-templates.com');
define('HTTPS_COOKIE_DOMAIN', '.survey-templates.com');

If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

"Headers already sent" - The definitive help

"Cannot redeclare ..." - How to find/fix it

SSL Implementation Help

Like this post? "Like" it again over there >

#182 Mazi

  • Community Member
  • 14 posts
  • Real Name:Marcel M.

Posted 06 September 2010, 22:36

You saved my day, thanks a ton!

For all others out there here is my solution:

At catalog/includes/configure.php change
define('HTTP_COOKIE_DOMAIN', 'http://www.yourdomain.com');
define('HTTPS_COOKIE_DOMAIN', 'https://www.yourdomain.com');
to:
define('HTTP_COOKIE_DOMAIN', 'www.yourdomain.com');
define('HTTPS_COOKIE_DOMAIN', 'www.yourdomain.com');

-> Leave out the http / https part.

Thanks once more,
Mazi

#183 trier

  • Community Member
  • 26 posts
  • Real Name:Jimbo

Posted 10 October 2010, 11:03

Hi,

At head head of this topic it was stated that the use of 'anchors' messes up the osCid ans shouldn't be used.

Trying to use -

echo tep_draw_form('checkout_payment', tep_href_link(FILENAME_CHECKOUT_SHIPPING, '#anchor', 'SSL'), 'post') . tep_draw_hidden_field('action', 'Options');

Causes a problem:
?osCsid=.......#anchor?osCsid=...........
is appended to the url (the first osCid is a regenerated one, the seconed osCid is the original one).


Playing about for a while I tried the following which seems to work (?) -

$goto=tep_href_link(FILENAME_CHECKOUT_SHIPPING, '', 'SSL') . '#anchor';
echo tep_draw_form('checkout_payment', $goto, 'post') . tep_draw_hidden_field('action', 'Options');


?osCsid=.......#anchor
is appended to the url (the correct osCid is added).



Is there a problem or lurking hidden dangers with this that I am not seeing?

Thanks

#184 germ

  • Community Member
  • 13,471 posts
  • Real Name:Jim
  • Gender:Male
  • Location:USA (GMT-6)

Posted 10 October 2010, 15:25

The correct use of "relative" links won't cause session loss.

Looks to me like you are using it correctly.
If I suggest you edit any file(s) make a backup first - I'm not perfect and neither are you.

"Headers already sent" - The definitive help

"Cannot redeclare ..." - How to find/fix it

SSL Implementation Help

Like this post? "Like" it again over there >

#185 trier

  • Community Member
  • 26 posts
  • Real Name:Jimbo

Posted 10 October 2010, 16:13

View Postgerm, on 10 October 2010, 15:25, said:

The correct use of "relative" links won't cause session loss.

Looks to me like you are using it correctly.

Thanks for the prompt reply (and the one I was hoping for). Appreciate it.

Edited by trier, 10 October 2010, 16:15.


#186 sackling

  • Community Member
  • 255 posts
  • Real Name:robert stein

Posted 23 November 2010, 05:45

Thanks for this post.

I am making my links as you recommended in the intial post and I am not losing my SID. I am just curious if there is a way so that the url in the browser doesnt have to show the SID always?

I am pretty sure it has to do with my configuration file and cookie directories but I am not sure what to change them to. I am running it only on my computer now using XAMPP. here is my file:

<?php
/*
  osCommerce, Open Source E-Commerce Solutions
  http://www.oscommerce.com

  Copyright (c) 2003 osCommerce

  Released under the GNU General Public License
*/

// Define the webserver and path parameters
// * DIR_FS_* = Filesystem directories (local/physical)
// * DIR_WS_* = Webserver directories (virtual/URL)
  define('HTTP_SERVER', 'http://localhost'); // eg, http://localhost - should not be empty for productive servers
  define('HTTPS_SERVER', 'https://localhost'); // eg, https://localhost - should not be empty for productive servers
  define('ENABLE_SSL', false); // secure webserver for checkout procedure?
  define('HTTP_COOKIE_DOMAIN', 'http://localhost');
  define('HTTPS_COOKIE_DOMAIN', 'https://localhost');
  define('HTTP_COOKIE_PATH', '/catalog/');
  define('HTTPS_COOKIE_PATH', 'catalog/');
  define('DIR_WS_HTTP_CATALOG', '/gostwear/catalog/');
  define('DIR_WS_HTTPS_CATALOG', '');
  define('DIR_WS_IMAGES', 'images/');
  define('DIR_WS_IMAGES_CAT', 'images/product_mid/');
  define('LARGE_IMAGES', 'images/product_big/');
  define('DIR_WS_ICONS', DIR_WS_IMAGES . 'icons/');
  define('DIR_WS_INCLUDES', 'includes/');
  define('DIR_WS_BOXES', DIR_WS_INCLUDES . 'boxes/');
  define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/');
  define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/');
  define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/');
  define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/');

  define('DIR_WS_DOWNLOAD_PUBLIC', 'pub/');
  define('DIR_FS_CATALOG', '/home/gostwear/gostwear.com/catalog/');
  define('DIR_FS_DOWNLOAD', DIR_FS_CATALOG . 'download/');
  define('DIR_FS_DOWNLOAD_PUBLIC', DIR_FS_CATALOG . 'pub/');

// define our database connection
  define('DB_SERVER', 'localhost'); // eg, localhost - should not be empty for productive servers
  define('DB_SERVER_USERNAME', 'root');
  define('DB_SERVER_PASSWORD', '');
  define('DB_DATABASE', 'gostwear');
  define('USE_PCONNECT', 'false'); // use persistent connections?
  define('STORE_SESSIONS', 'mysql'); // leave empty '' for default handler or set to 'mysql'
?>

Edited by sackling, 23 November 2010, 05:54.


#187 ErikMM

  • Community Member
  • 198 posts
  • Real Name:Erik M
  • Gender:Male

Posted 05 January 2011, 20:28

I made a (mal)functioning menu sprite in lieu of the default category menu with text links. The links for my sprite are not working or I get a 404:File Not Found.

I followed spooks advice on HOW TO HIDE THE SID (thread p.4).

I tried these link methods:
1) per spooks p.1:
<a href="<?php echo tep_href_link(FILENAME_DEFAULT); ?>">Back Home</a>
2) per Robert p.8:
Products Link
<a href="<?php echo tep_href_link( FILENAME_PRODUCT_INFO, 'products_id=1234' ) ?>">1234</a>
Categories Link
<a href="<?php echo tep_href_link( FILENAME_DEFAULT, 'cPath=1234' ) ?>">1234</a>
How I tried the above methods failed to work (version 2.3.1):
Cat
<a href="<?php echo tep_href_link( FILENAME_DEFAULT, \'cPath=22_32\' )?>">this link placed over the sprite image</a>
Prod
<a href="<?php echo tep_href_link( FILENAME_PRODUCT_INFO, \'products_id=34\' ) ?>">this link placed over the sprite image</a>

A "normal" link(mystore.com/catalog/index.php?cPath=22_32) works with the sprite, but of course no osCsid is created.

Related?:

Quote

p.4: usually you will only see the sid on the first page when you visit the site, thereafter not.
close ALL of your browser windows then go to your site.
p.3: Hover over any link and you will see in the bottom bar that the link has an osCsid appended to it.
If you then click that link then once again hover over a link when the page reloads the link should now be free of any osCsid.
Despite the sprite link not working, ALL other links (any box link, any page) the sid is persistent-- every hover, every page...all the time.

my config is set correctly (I think):
define('HTTP_SERVER', 'http://mystore.com');
  define('HTTPS_SERVER', 'https://mystore.com');
  define('ENABLE_SSL', true);
  define('HTTP_COOKIE_DOMAIN', '.mystore.com');
  define('HTTPS_COOKIE_DOMAIN', '.mystore.com');
  define('HTTP_COOKIE_PATH', '/catalog/');
  define('HTTPS_COOKIE_PATH', '/catalog/');
  define('DIR_WS_HTTP_CATALOG', '/catalog/');
  define('DIR_WS_HTTPS_CATALOG', '/catalog/');
  define('DIR_WS_IMAGES', 'images/');
  define('DIR_WS_ICONS', DIR_WS_IMAGES . 'icons/');
  define('DIR_WS_INCLUDES', 'includes/');
  define('DIR_WS_BOXES', DIR_WS_INCLUDES . 'boxes/');
  define('DIR_WS_FUNCTIONS', DIR_WS_INCLUDES . 'functions/');
  define('DIR_WS_CLASSES', DIR_WS_INCLUDES . 'classes/');
  define('DIR_WS_MODULES', DIR_WS_INCLUDES . 'modules/');
  define('DIR_WS_LANGUAGES', DIR_WS_INCLUDES . 'languages/');

2.3.1 A How To Road Map

show some love [img]http://forums.oscommerce.com/public/style_images/master/add.png[/img]

Another Newbie Road Map | Basic oSc design | How to Make a Horrible Website | SSL made simple | Web Developer is a POWERFUL (free) TOOL for web design.

the consent theory of government is "the universal demolisher of all governments, but not the builder of any."

#188 FWR Media

  • Community Member
  • 6,462 posts
  • Real Name:Robert Fisher
  • Gender:Male
  • Location:Stowmarket - Suffolk - UK

Posted 05 January 2011, 20:39

View PostErikMM, on 05 January 2011, 20:28, said:

2) per Robert p.8:
Products Link
<a href="<?php echo tep_href_link( FILENAME_PRODUCT_INFO, 'products_id=1234' ) ?>">1234</a>

You are escaping characters that should not be escaped ( and in the process creating a PHP parse error ) ..

<a href="<?php echo tep_href_link( FILENAME_PRODUCT_INFO, \'products_id=34\' ) ?>">this link placed over the sprite image</a>

Should be ..

<a href="<?php echo tep_href_link( FILENAME_PRODUCT_INFO, 'products_id=34' ) ?>">this link placed over the sprite image</a>

Edited by FWR Media, 05 January 2011, 20:40.

Ultimate SEO Urls 5 PRO - Multi Language Modern, Powerful SEO Urls

KissMT Dynamic SEO Meta & Canonical Header Tags

KissER Error Handling and Debugging

If you found my post useful please click the green + sign to the right

Please only PM me for paid work.


#189 ErikMM

  • Community Member
  • 198 posts
  • Real Name:Erik M
  • Gender:Male

Posted 06 January 2011, 09:39

View PostFWR Media, on 05 January 2011, 20:39, said:

You are escaping characters that should not be escaped ( and in the process creating a PHP parse error ) ..
If I don't escape the entire site "breaks." If I put it outside the php tags it works great...sid included, but then it is not placed in the div where I need it.

I should elaborate...in order for the sprite to work (or put the links over the graphic in the right spot) I have to have the link within a list:
<li id="navStickers"><a href="<?php echo tep_href_link( FILENAME_DEFAULT, \'cPath=22_32\' )?>"></a></li>
It turns out the links do indeed work in the div I need them (only with "\"), but only WITHOUT the <li>. However, without the <li> the sprite is not functional as the links won't line up where they are supposed to.

Edited by ErikMM, 06 January 2011, 09:49.

2.3.1 A How To Road Map

show some love [img]http://forums.oscommerce.com/public/style_images/master/add.png[/img]

Another Newbie Road Map | Basic oSc design | How to Make a Horrible Website | SSL made simple | Web Developer is a POWERFUL (free) TOOL for web design.

the consent theory of government is "the universal demolisher of all governments, but not the builder of any."

#190 ErikMM

  • Community Member
  • 198 posts
  • Real Name:Erik M
  • Gender:Male

Posted 06 January 2011, 10:05

View PostErikMM, on 06 January 2011, 09:39, said:

It turns out the links do indeed work in the div I need them (only with "\"), but only WITHOUT the <li>. However, without the <li> the sprite is not functional as the links won't line up where they are supposed to.
Let me rephrase this part: Links don't work in the div with the \ (the site stays functional, but the links lead to 404 errors). Outside the php tags and without the \ they work with a sid included.

In summary, the links need to function within the php tags, and within the list.

Edited by ErikMM, 06 January 2011, 10:06.

2.3.1 A How To Road Map

show some love [img]http://forums.oscommerce.com/public/style_images/master/add.png[/img]

Another Newbie Road Map | Basic oSc design | How to Make a Horrible Website | SSL made simple | Web Developer is a POWERFUL (free) TOOL for web design.

the consent theory of government is "the universal demolisher of all governments, but not the builder of any."

#191 ErikMM

  • Community Member
  • 198 posts
  • Real Name:Erik M
  • Gender:Male

Posted 07 January 2011, 09:31

Got it! :D After lots of trial and error:

'  <div class="ui-widget-content infoBoxContents" style="border-color:transparent" id="sign">' .

'  <li id="navStickers"><a href="'.tep_href_link( FILENAME_DEFAULT, 'cPath=22_2_3_10' ).'"></a></li>'.
'  <li id="navCaps"><a href="'.tep_href_link( FILENAME_DEFAULT, 'cPath=22_2_3_33' ).'"></a></li>'.
'  <li id="navTotes"><a href="'.tep_href_link( FILENAME_DEFAULT, 'cPath=22_2_3_13' ).'"></a></li>'.

  ' </div>' .
The id=sign refers to a png image used for the sprite which is linked in the stylesheet.

It works great and really improves the look...away from stock. B)

So, in my case, I had to construct a link for A CATEGORY as:
<a href="'.tep_href_link( FILENAME_DEFAULT, 'cPath=22_2_3_10' ).'"></a>
My only issue now is persistent sids on very link and every page.
2.3.1 A How To Road Map

show some love [img]http://forums.oscommerce.com/public/style_images/master/add.png[/img]

Another Newbie Road Map | Basic oSc design | How to Make a Horrible Website | SSL made simple | Web Developer is a POWERFUL (free) TOOL for web design.

the consent theory of government is "the universal demolisher of all governments, but not the builder of any."

#192 Biancoblu

  • Community Sponsor
  • 542 posts
  • Real Name:Isabella
  • Gender:Female
  • Location:Switzerland

Posted 17 January 2011, 13:56

I hope I post in the correct thread.
Years ago a developer that worked on my shop replaced "osCid" with "myshopID" in my url's....I've been searching my files but can't find where to go to edit this.
Can someone please shed some light?
~ Don't mistake my kindness for weakness ~

Be safe, not sorry: Updated Security Thread

#193 FWR Media

  • Community Member
  • 6,462 posts
  • Real Name:Robert Fisher
  • Gender:Male
  • Location:Stowmarket - Suffolk - UK

Posted 17 January 2011, 14:05

View PostBiancoblu, on 17 January 2011, 13:56, said:

I hope I post in the correct thread.
Years ago a developer that worked on my shop replaced "osCid" with "myshopID" in my url's....I've been searching my files but can't find where to go to edit this.
Can someone please shed some light?

includes/application_top.php

tep_session_name('osCsid');

or in your case ..

tep_session_name('myshopID');
Ultimate SEO Urls 5 PRO - Multi Language Modern, Powerful SEO Urls

KissMT Dynamic SEO Meta & Canonical Header Tags

KissER Error Handling and Debugging

If you found my post useful please click the green + sign to the right

Please only PM me for paid work.


#194 Biancoblu

  • Community Sponsor
  • 542 posts
  • Real Name:Isabella
  • Gender:Female
  • Location:Switzerland

Posted 17 January 2011, 14:29

Great I got it :thumbsup: thanks for helping.
~ Don't mistake my kindness for weakness ~

Be safe, not sorry: Updated Security Thread

#195 spoofy

  • Community Member
  • 181 posts
  • Real Name:Spoofy

Posted 19 January 2011, 00:35

View PostFWR Media, on 17 January 2011, 14:05, said:

includes/application_top.php

tep_session_name('osCsid');

or in your case ..

tep_session_name('myshopID');


Robert, so if I wanted to change oscid to let's say secid, which appears in url, then that's all I have to change?

#196 spoofy

  • Community Member
  • 181 posts
  • Real Name:Spoofy

Posted 19 January 2011, 00:36

I am reading conflicting information in this thread.

Cookie path should be this:

define('HTTP_COOKIE_DOMAIN', 'www.survey-templates.com');
define('HTTPS_COOKIE_DOMAIN', 'www.survey-templates.com');

Or should it be this (based on my research this is the correct format:

define('HTTP_COOKIE_DOMAIN', '.survey-templates.com');
define('HTTPS_COOKIE_DOMAIN', '.survey-templates.com');


#197 FWR Media

  • Community Member
  • 6,462 posts
  • Real Name:Robert Fisher
  • Gender:Male
  • Location:Stowmarket - Suffolk - UK

Posted 31 January 2011, 11:22

Readers of this topic may also be interested in: -

osCsid & why you SHOULD lose it
why forcing cookie usage is the ideal
Ultimate SEO Urls 5 PRO - Multi Language Modern, Powerful SEO Urls

KissMT Dynamic SEO Meta & Canonical Header Tags

KissER Error Handling and Debugging

If you found my post useful please click the green + sign to the right

Please only PM me for paid work.


#198 techgoddess

  • Community Member
  • 29 posts
  • Real Name:Athena
  • Gender:Female
  • Location:Costa Rica

Posted 02 August 2011, 22:38

Just a quick note. I'm running "Ultimate SEO Urls 5 PRO r205" on my site and I love it. I'm also using anchors on my FAQ page. In FF the anchors work beautifully using the code Germ posted below but for some reason IE was appending the osCsid and causing the anchors to fail no matter how many different pages were being visited. I changed my link code from what Germ posted to the following and it works.

THE LINK:
<a href="' . tep_href_link(FILENAME_FAQ) . ('#001') . '"><b>How much does it cost to attend an event?</b></a><br>


and then

THE ANCHOR:
<A NAME="001"><b>How much does it cost to attend an event? </b></a><br> ADD ANSWER
.

The osCsid should not show after a couple of clicks in the site but what if your page with anchors is the first page visited or something is goofy with IE (like always)? I just wanted to share after spending two days cussing and screaming at IE.

Luck!
Athena

View Postgerm, on 23 August 2010, 22:46, said:

Relative link help

Or simplified using no parameters the link code becomes something like:

<?php
  echo '<a href="' . tep_href_link(basename($PHP_SELF),'#jump') . '">Jump</a>';
?>

And the target anchor looks like:

<a name="jump">Jump</a>

I have this code in a test page I use and it works and I don't lose the osCsid.
:)

Edited by techgoddess, 02 August 2011, 22:39.