Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 26
  1. #11
    Join Date
    Apr 2008
    Posts
    31
    Plugin Contributions
    0

    Default Re: My idea for accessing zen cart sessions outside of zen...

    sorry 1 more thing...

    I know people over here LOVE to threadcrap just so they can get a dig at someone thinking outside the box
    I always think outside the box! In programming, if you dont you get nowhere most of the time! Bollocks to people who put others down, i dont care i have a nicely paid job to think outside the box! lol

  2. #12
    Join Date
    Apr 2007
    Location
    Herts. UK
    Posts
    890
    Plugin Contributions
    4

    Default Re: My idea for accessing zen cart sessions outside of zen...

    Quote Originally Posted by glenelkins View Post
    The main thing is i cannot understand what zen cart does to stop session working outside of itself.
    It doesn't actively stop sessions working outside itself. Did you set up the session handler correctly? Most Zen Cart installations store the session information in the database and Zen Cart uses a custom session handler for this.

    Regards,
    Christian.

  3. #13
    Join Date
    Apr 2008
    Posts
    31
    Plugin Contributions
    0

    Default Re: My idea for accessing zen cart sessions outside of zen...

    well in the login code it sets $_SESSION

    but if you try accessing one of the var from a script outside the folder zen cart runs in, it does work. Its strange, every application iv ever written i can access my session vars in any folder i wish from any script file i wish

  4. #14
    Join Date
    Apr 2007
    Location
    Herts. UK
    Posts
    890
    Plugin Contributions
    4

    Default Re: My idea for accessing zen cart sessions outside of zen...

    Quote Originally Posted by glenelkins View Post
    well in the login code it sets $_SESSION

    but if you try accessing one of the var from a script outside the folder zen cart runs in, it does work. Its strange, every application iv ever written i can access my session vars in any folder i wish from any script file i wish
    Zen Cart uses a custom session handler to store its session data. You cannot access the session data from $_SESSION until the data has been reloaded by the session handler. You'll need to read up on session_set_save_handler() and review the code in includes/functions/sessions.php .

    Regards,
    Christian.

  5. #15
    Join Date
    Apr 2008
    Posts
    31
    Plugin Contributions
    0

    Default Re: My idea for accessing zen cart sessions outside of zen...

    The _sess_read() function has a value $key that it uses. What is this? And im not sure how this parses the $key value if you look here:

    session_set_save_handler('_sess_open', '_sess_close', '_sess_read', '_sess_write', '_sess_destroy', '_sess_gc');


    Where in this line does it parse data to the _sess_read function?

  6. #16
    Join Date
    Apr 2008
    Posts
    31
    Plugin Contributions
    0

    Default Re: My idea for accessing zen cart sessions outside of zen...

    iv actually gone for storing session in files it works very well by getting the session id from $_COOKIE['zenid']; then unserializing the session file and checking for customer_id


  7. #17
    Join Date
    Apr 2008
    Posts
    31
    Plugin Contributions
    0

    Default Re: My idea for accessing zen cart sessions outside of zen...

    So it works like this:

    Set zen cart to store sessions as files.

    Code:
    $sess_id = $_COOKIE['zenid'];
    
    $session_file = "/PATH/TO/ZEN/CACHE/sess_" . $sess_id;
    
    $session_data = @file_get_contents ( $session_file );
    
    $data = CUSTOM_UNSERIALIZE_FUNCTION ( $session_data );
    
    foreach ( $data as $k => $v ) {
    
        if ( $k == "customer_id" && !empty ( $v ) ) {
    
            // USER IS LOGGED IN
            $customer_id = $v;
    
        }
    
    }
    Seems to work pretty nicely!

  8. #18
    Join Date
    Sep 2008
    Posts
    24
    Plugin Contributions
    0

    Default Re: My idea for accessing zen cart sessions outside of zen...

    Is there any other way to access session variables outside of zen cart (but on the same server in a directory containing it) or is this it?

  9. #19
    Join Date
    Sep 2008
    Posts
    24
    Plugin Contributions
    0

    Default Re: My idea for accessing zen cart sessions outside of zen...

    Quote Originally Posted by glenelkins View Post
    ...the vailidation is done on the textpattern side in this case!
    If the session variable is sent over to a grassroots page(no CMS - all php/html), do you know how this sort of identity validation be accomplished in php? I have enough of an understanding of php to read through and understand most scripts, but I'm not great at getting scripts to work - at least not quickly, so any help would be amazing. : )

  10. #20
    Join Date
    Aug 2005
    Location
    Arizona
    Posts
    27,755
    Plugin Contributions
    9

    Default Re: My idea for accessing zen cart sessions outside of zen...

    oboeonetwothree,

    What is it precisely that you are attempting to do in detail
    Zen-Venom Get Bitten

 

 
Page 2 of 3 FirstFirst 123 LastLast

Similar Threads

  1. Using zen cart sessions outside of zen cart
    By rasher in forum General Questions
    Replies: 0
    Last Post: 29 Jul 2009, 08:22 PM
  2. A pretty weird problem while accessing session outside of zen
    By yellow1912 in forum Contribution-Writing Guidelines
    Replies: 2
    Last Post: 1 Jul 2009, 02:44 AM
  3. Use Zen Variables outside Zen Cart
    By renkforce in forum General Questions
    Replies: 0
    Last Post: 4 Mar 2009, 07:12 PM
  4. Zen Cart Idea/Question
    By SOCiETi in forum General Questions
    Replies: 0
    Last Post: 28 Aug 2007, 07:56 PM
  5. Replies: 4
    Last Post: 30 Oct 2006, 12:59 PM

Posting Permissions

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