Reputation: 83264
Is it possible to modify the values inside the super global array _Session in PhP? Assume that the _Session is writing to files.
The reason I ask this is because I have two application, the front end and the back end. The backend uses some variables inside the _Session object, and the front end must be able to modify those values so that it can communicate with the backend.
Upvotes: 0
Views: 204
Reputation: 57825
If the two application are sharing a PHP session, then each can happily modify $_SESSION
.
For this to happen you will need to make sure both applications are storing the sessions in the same place and either:
session_set_cookie_params()
.or
session_id('back-end SessionId
here')
before calling
session_start()
. The two
applications should then have the
same session. The front-end application would then lose any data it had already stored up to this point in its original session.Either way, two applications communicating by sharing session data doesn't seem a great solution
Upvotes: 2
Reputation: 70001
$_SESSION is just as modifiable as $_POST and $_GET, just know that writing to $_SESSION and then doing a header redirect does not work since the session values arent written.
Upvotes: 1