hatimad Posted November 20, 2002 Posted November 20, 2002 Hi, can anyone through some light on how session Id works? on what links they are supposed to be displayed? when i point to any link on my site, session ID is attached to it, i point my mouse again on the link after refreshing it and it doesnt show sessionID but when i click on any link, it starts showing session ID again can anyone tell me why it might be happening and how can i stop it? thank you
Guest Posted November 20, 2002 Posted November 20, 2002 when i point to any link on my site, session ID is attached to it, i point my mouse again on the link after refreshing it and it doesnt show sessionID osCommerce uses PHP's default mechanism for propagating the session id. This is what happens: * On the first page you load, a cookie is sent to the browser with the session id and the session id appended to all URL's. * On the second page, 1 of 2 things can happen: - The cookie survived, which means the browser has cookies enabled so we stop appending the session ID to the URL. - The cookie isn't there, the browser has no cookies, so we keep on appending the session id to the URL. Hope it helps
hatimad Posted November 20, 2002 Author Posted November 20, 2002 thank you for your reply, so it means one of 2 things 1) Cookies doesnt get set at the first time (which is unlikely) 2) or even after cookies is set, my site keeps sending it again (due to modification in code) i changed code in header.php from <td align="right" class="headerNavigation"><?php if (tep_session_is_registered('customer_id')) { ?><a href="<?php echo tep_href_link(FILENAME_LOGOFF, '', 'NONSSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_LOGOFF; ?></a> | <?php } ?><a href="<?php echo tep_href_link(FILENAME_ACCOUNT, '', 'NONSSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_MY_ACCOUNT; ?></a> | <a href="<?php echo tep_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CART_CONTENTS; ?></a> | <a href="<?php echo tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CHECKOUT; ?></a> </td> to <td align="right" class="headerNavigation"><?php echo ( (!tep_session_is_registered('customer_id') and (!strstr($PHP_SELF,FILENAME_LOGIN) and !strstr($PHP_SELF,'create')) ) ? ('<a href="' . tep_href_link(FILENAME_LOGIN, '', 'SSL') . '"' . ' " class="headerNavigation">' . HEADER_TITLE_LOGIN . '</a> | ') : ''); ?><?php echo ( (!tep_session_is_registered('customer_id') and (!strstr($PHP_SELF,FILENAME_CREATE_ACCOUNT) and !strstr($PHP_SELF,'create')) ) ? ('<a href="' . tep_href_link(FILENAME_CREATE_ACCOUNT, '', 'SSL') . '"' . ' " class="headerNavigation">' . HEADER_TITLE_CREATE_ACCOUNT . '</a> | ') : ''); ?><?php if (tep_session_is_registered('customer_id')) { ?><a href="<?php echo tep_href_link(FILENAME_LOGOFF, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_LOGOFF; ?></a> | <?php } ?><?php if (tep_session_is_registered('customer_id')) { ?><a href="<?php echo tep_href_link(FILENAME_ACCOUNT, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_MY_ACCOUNT; ?></a> | <?php } ?> <a href="<?php echo tep_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CART_CONTENTS; ?></a> | <a href="<?php echo tep_href_link(FILENAME_CHECKOUT_PAYMENT, '', 'SSL'); ?>" class="headerNavigation"><?php echo HEADER_TITLE_CHECKOUT; ?></a> </td> could this be reason? if yes what did i do wrong? thanks again for the reply Hatim
Guest Posted November 20, 2002 Posted November 20, 2002 could this be reason? I dont think so, the changes look ok. Maybe you are seeing the session id reappear in the URL when you switch to secure mode. The SSL server is a different server than the nonSSL one and cookies have to be sent in again.
hatimad Posted November 20, 2002 Author Posted November 20, 2002 let me try to explain what happens again when i open page http://bindionline.com/echocart/default.php and point my cursor to any of the link, sessionID is attached to the link (which i can see in status bar) once i referesh the page session ID is gone from the link (which i can see in status bar) now i click on any of the category link (sessionID is not attached at this point) again i start pointing cursor to the links (on the newly opened page) and the sessionID is back there is no change in the server, all are NONSSL links thank you
toktas Posted December 28, 2002 Posted December 28, 2002 I am having a very similar problem. It seems like i am losing my session IDs after the first page. I have changed my sessions setting to 'mysql', but it still doesnt help. And when i look in my cookies directory, i don't see any cookies from my site.
Recommended Posts
Archived
This topic is now archived and is closed to further replies.