Reputation: 3690
Consider the following scenario:
The enigma: child.php needs to have the same session state as parent.php in order to give the information parent.php requested.
Is this possible?
Upvotes: 0
Views: 387
Reputation: 11832
Sessions are usually assigned through cookies being set and recognized. GET variables are also used sometimes, but is considered an elevated security threat, as the GET variable is visible in the URL.
PHP can be set to a certain level of strictness when it comes to when to re-use an existing session. You can, for example, fiddle with:
The default settings are not very strict.
When all conditions are met, PHP will automatically re-use the existing session when session_start() is called.
Upvotes: 0
Reputation: 633
As long as you call session_start()
at the top of each script, both scripts are on the same domain, and the session cookie isn't confined to a subdirectory, the variables you set in $_SESSION
on the first request will still exist in the second.
Upvotes: 3