Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Why I get no session id?


RyuMaster

Recommended Posts

Hi! I have some custom code snippet. Based on GET data, it fills cart with products, and redirects to shopping cart. Also it sets custom session variable on the way. The problem is... it works only once!! If I close browser, use same link again, I get "shopping cart is empty", like no session ID data is passed anymore. WHY???

 

http://www.balblabla.com/checkout_sample.php?tempData=9884959&name0=Base0

 

 

 

require('includes/application_top.php');

 

 

$first = 0;

$ses = "";

$q = explode("&",$_SERVER["QUERY_STRING"]);

 

foreach ($q as $qi)

{

if ($qi != "")

{

$qa = explode("=",$qi);

list ($key, $val) = $qa;

if ($val){

if($first != 0)

{

$products_query = tep_db_query("SELECT * FROM " . TABLE_PRODUCTS_DESCRIPTION . " WHERE products_name = \"".$val ."\"");

$products = tep_db_fetch_array($products_query);

 

$products_query2 = tep_db_query("SELECT * FROM " . TABLE_PRODUCTS_ATTRIBUTES . " WHERE options_id = \"6\" AND products_id = \"".$products["products_id"] ."\"");

$attributes_mysql = tep_db_fetch_array($products_query2);

 

$attributes = array(6 => $attributes_mysql["options_values_id"]);

$cart->add_cart($products["products_id"],1,$attributes);

echo "add";

 

}

else

{

 

echo "id?". tep_session_id();

 

$cart->remove_all();

 

tep_session_register('id_string');

$_SESSION['id_string']= $val;

$first = 1;

 

 

}

 

}

}

}

 

tep_redirect(tep_href_link(FILENAME_SHOPPING_CART, '', 'NONSSL', true))

 

And I can see that tep_session_id() always returns correct session variable. Argh!!! Also, backend settings are:

 

 

Force Cookie Use False

Check SSL Session ID False

Check User Agent False

Check IP Address False

Prevent Spider Sessions True

Recreate Session True

Link to comment
Share on other sites

I have standart install, no custom modifications or anything. Except this php script is my own. So you say this behavior is predictable. hmmm. I thought cart contents are getting removed because oscid is removed, but then maybe I have to look somewhere else for the solution, around the cart empty function I use or something. Still, I checked the order with echo, it always the same. Firstly, function removes cart contents. Then adds products. HMM

 

 

I did more tests, actually removing those lines completely

 

$cart->remove_all();

 

tep_session_register('id_string');

$_SESSION['id_string']= $val;

still yields same result. So I don't know where to start now.

Link to comment
Share on other sites

Actually I did more tests. It always starts working if I close browser/open it again. Else not matter what I do - completely delete cookies, history erase - no good, works just for a first time. Deleting sessions from database not helping too.

So if taht is not sessions and cookies, then what? 0_0 headers?

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...