Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

osCommerce SESSION var problem...

Status
Not open for further replies.

Elliott3

Programmer
Sep 5, 2002
347
0
0
CA
I have been trying to figure out this problem with sessioin variables all day... this is really the firt time ive looked at oscommerce but I am snapping it in among sections of a website..

What I need to be able to do is to simply create a session variable in a page within the 'store' driectory and and access that session variable outside of the 'store' directory... it doesn't seem to be straight forward??? If anyone can shed any light I would really appreciate it.

CES
 
I set the variable under the store directory in the normal way... $_SESSION['my_sess'] = "this"; I have checked the variable after it is set by outputting it to the screen and it is ok...I then check the variable on the next page and i find that it is no longer set.. i test with th isset() method...

oscommerce seems to have their own session management but there should be a way araound this.. Its seems as though the session gets dumped at the end of each page but the variables that I create can be used throughout the store directory.. just not when I go outside of that directory..

could 'HTTP_COOKIE_DOMAIN' or something like that have any affect on the problem.. open to anything...

CES
 
I checked and it just shows a forward slash '/'.. what does this mean?

In the oscommerce source code they have this:

define('PHP_SESSION_NAME', 'osCsid');
define('PHP_SESSION_PATH', $cookie_path);
define('PHP_SESSION_DOMAIN', $cookie_domain);
define('PHP_SESSION_SAVE_PATH', SESSION_WRITE_DIRECTORY);


Is this what i should be looking into?

CES
 
The "/" means "for the entire directory structure of the site".

Examine:

define('PHP_SESSION_PATH', $cookie_path);

Look in the OSCommerce config files and see what "PHP_SESSION_PATH" is set to.


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Does this make any senseto you?

$cookie_path = (($request_type == 'NONSSL') ? HTTP_COOKIE_PATH : HTTPS_COOKIE_PATH);
 
Yes. This is an example of PHP's trinary operator. It is logically equivalent to:

if ($request_type == 'NONSSL')
{
$cookie_path = HTTP_COOKIE_PATH
}
else
{
$cookie_path = HTTPS_COOKIE_PATH;
}

Now look to see what HTTP_COOKIE_PATH and HTTPS_COOKIE_PATH are set to.


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
It is set to '/store' ... should i change that to '/' to include the root dir?

CES
 
If that's what you need....

The only problem I can see is when you go to the admin section, there might be spurious data there.


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Thanks..

Are you familiar with the osCommerce software?

CES
 
Is it possible to create a session within another session?

CES
 
osCommerce software is shopping cart stuff. if that is what you were asking...

the session thing i was thinking that maybe i could create a new set of session variables under a new name or something to maintain these extra variables... I'm kinda runnin outta ideas..

CES
 
I changed them to '/' and it made no difference... the osCommerce software does some session managment of its own... i figure thats whats causeing the problem?

CES
 
Do you see code where OSCommerce is actually using the session-configuration values set in the define() statements you posted?


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Yes and No... the code seems pretty complicated and there is little documentation. I really appreciate you taking the time to help out. I don;'t really know what else I can post for a question.
 
Is there a way that you know to create a second set of session variables within a current session?

So I could set / request specific session variables?

any thoughts about that?
 
Somewhere in the configuration scripts there will likely be an invocation of session_set_cookie_params().

Generally, when I was modifying OSCommerce to suit my purposes, I used a text editor that could search multiple files on a filesystem.


Want the best answers? Ask the best questions!

TANSTAAFL!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top