I'm currently working on an electron app on the client side, and an apache server for the backend.
This means that the app and the server are not on the same domains and the php files are called via jsonp (this is on a private network).
My problem is that I cannot set $_SESSION and $_COOKIES as the "calls" are made with jsonp and that the server is making a new session for each one : when i output the session_id() it is different everytime.
To be clear this is what I mean as json call (done in electron) :
var s = document.createElement("script");
s.src = "example.com/user.php?id="+username;
document.body.appendChild(s);
This php file echo connect(...)
and the function connect is defined in the same document that creates the script.
What I want is to keep the session that the call as made.
I've thought of the following solutions :
- Make an entry in the database with the data I wanted to have in $_SESSION
- Get the session_id() and then set it in my other sessions with
session_id($session)
Are there other solutions ? Which one would be better ?
Any feedback is appreciated !