Results 1 to 4 of 4

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 ...

      
  1. #1
    Lurker
    Join Date
    Feb 2004
    Posts
    4
    Rep Power
    0


    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?

  2. #2
    Active Member
    Join Date
    Jan 2003
    Location
    Surrey, UK
    Posts
    126
    Rep Power
    0


    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

  3. #3
    Lurker
    Join Date
    Feb 2004
    Posts
    4
    Rep Power
    0


    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...

  4. #4
    Active Member
    Join Date
    Jan 2003
    Location
    Surrey, UK
    Posts
    126
    Rep Power
    0


    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

Similar Threads

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

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •