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 ...
| |||||||
| Register | FAQ | Members List | Calendar | Mark Forums Read |
|
#1
| |||
| |||
| 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? |
|
#2
| |||
| |||
| 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 |
|
#3
| |||
| |||
| 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... |
|
#4
| |||
| |||
| 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 |
| Thread Tools | |
| |
| ||||
| 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 |