osCommerce and osCMax shopping cart software forums

Shopping Cart Software

osCommerce with teeth!

 

coexistence of oscommerce and my session variables

This is a discussion on coexistence of oscommerce and my session variables within the osCommerce 2.2 Modification Help forums, part of the osCommerce 2.2 Forums category; i'm new to oscommerce, so bear with me. i'm trying to integrate oscommerce into my existing PHP site, such that ...


Go Back   osCommerce and osCMax shopping cart software forums > osCommerce 2.2 Forums > osCommerce 2.2 Modification Help

Register FAQ Members List Calendar Mark Forums Read


Free community membership! Fast easy FREE membership
Closed Thread

 

LinkBack Thread Tools
  #1  
Old 02-11-2004, 04:56 AM
Lurker
 
Join Date: Feb 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
sdavid14
Default coexistence of oscommerce and my session variables

i'm new to oscommerce, so bear with me.

i'm trying to integrate oscommerce into my existing PHP site, such that upon login into oscommerce, i execute some of my PHP code that does a db lookup and sets session variables that i use later in my application.

i've not met with success, as it seems that the application_top.php is doing something with the user session that i can't seem to figure out. i've boiled my problem down to the following code test cases that dont' seem to work:

set_session.php:

<?php
require('includes/application_top.php');
session_start();
$_SESSION['customer_id']="1234";
header("Location: retrieve_session.php");
require(DIR_WS_INCLUDES . 'application_bottom.php');
?>

retrieve_session.php:

<?php
require('includes/application_top.php');
session_start();
echo "customer id: " .$_SESSION['customer_id'];
require(DIR_WS_INCLUDES . 'application_bottom.php');
?>

i expect to see:

customer id: 1234

but instead i see:

customer id:


what's my fundamental misunderstanding here?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
  #2  
Old 02-11-2004, 05:57 AM
Active Member
 
Join Date: Jan 2003
Location: Surrey, UK
Posts: 126
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
jonthewebb
Default

bah

I just wrote a long reply and it went missing

anyway, the gist of it was, use tep_session_register() inside application_top if you can, then it will work. Um, don't know if that's any help, depends what you're trying to do.

Oh yes and you shouldn't need to call session_start again as application_top does that already.


jon
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
  #3  
Old 02-11-2004, 07:17 PM
Lurker
 
Join Date: Feb 2004
Posts: 4
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
sdavid14
Default

Thank you! Your advice got me on the right track.

The other problem i was having was that i was trying to redirect the user after logging in (login.php) to a non-oscommerce page via the following, hoping to preserve the session variables :

tep_redirect("registered.php");

turns out that the wrapper function tep_href_link is needed to make sure the session is passed along with it (on the querystring, if necessary).

tep_redirect(tep_href_link("registered.php"));

I appreciate the help, hope this can help someone else in the future...
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
  #4  
Old 02-12-2004, 03:02 AM
Active Member
 
Join Date: Jan 2003
Location: Surrey, UK
Posts: 126
Thanks: 0
Thanked 0 Times in 0 Posts
Rep Power: 0
jonthewebb
Default

yes, I used to have all sorts of problems until I started using the tep_ functions where possible. So much is built in or dependent on them that little bits start flaking off if you don't use them. A good plough through the includes/functions and includes/classes is very useful. I have re-used many of the functions for other projects too. tep_not_null() is useful.


jon
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Closed Thread

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads

Thread Thread Starter Forum Replies Last Post
variables I can't find in configuration, BOX_WIDTH bumpy osCMax v1.7 Installation 1 11-24-2004 06:56 PM
session id in URL cominus osCMax v1.7 Discussion 3 11-11-2004 05:34 PM
Variables contained in Breadcrumb Trail carab osCommerce 2.2 Modification Help 3 10-17-2004 11:46 AM
Session ID andyy15 osCommerce 2.2 Modification Help 3 08-15-2004 11:40 PM
SSL Errors, Session Cookie, Session Cache, NOVICE Problems? hanool osCommerce 2.2 Modification Help 1 09-07-2003 11:49 AM


All times are GMT -8. The time now is 10:08 PM.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO
http://www.oscmax.com/forums/
Copyright 2008 osCMax