MindLerp
MindLerp

Reputation: 378

Save php sessions id per user

I'm trying to save a session per user in the server.

The objetive is doing this without using cookies in the local store of user.

If the user clicks on remember me, the server will save the session of a user y even if the browser was closed, thus, the user will still be logged in.

I tried to avoid a database with SessionHandler but I do not know how to do it.

Can someone explain to me how can I save the session on the server?

Upvotes: 1

Views: 104

Answers (1)

Clay
Clay

Reputation: 4760

You need cookies if you want the user's session to be remembered after a browser close.

Do you mean you want to use localStorage to save the id? Honestly, I'm not sure how that's much different then storing a cookie or if it would work. If you try to use localStorage, when the user logs in you would want to store the session id generated by PHP using JS. You would want also to enable session.use_trans_sid=1 so it'll pass the session id in the URL.

You haven't posted any code but when you do maybe we can help you more when you get stuck.

Upvotes: 1

Related Questions