Jump to content

how to get a unique session id


Recommended Posts

Hi,

I have the following problem.
I created a module for presta, in which i have a php ajax backend file that services javascript requests
I want to get a unique identifier of the session of the user.
Now session id wont return anything. Presta will let me do a session start in the php backend file , in order to get a session id, but it is unique to that file, i need something to identify the frontend session. Maybe the global cookie object?

Hope i made it clear. My entire system depends on this feature.

Alex

Link to comment
Share on other sites

  • 2 months later...

Hi, i have found a fix for this.
It turns out that presta doesn't use native php session support( $_SESSION array and session_* function ). Instead it uses encrypted cookies to send session data along with EACH http request/reply.
Thus, instead of working with $_SESSION you must use $cookie which a singleton instance of Cookie class. You can attach any properties you like to it an use them anywhere in the session.
See this post for an example: "save a session variable"

Link to comment
Share on other sites

  • 1 year later...

Hi,

 

I'm interested by getting a unique session id by prestashop. I just read the article about cookie, but i have one question, is the property _name of the cookie class unique?

 

I took a look in the class but i didn't find any comment on the property to tell me if the variable is unique, or not.

Link to comment
Share on other sites

  • 3 years later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...