SiemensSEN
asked on
php and session variable
Hello,
I have a PHP web application that I am have some problem with keeping the session unique.
here is what is happening
1:Open Browser 1 , login .. get a session ID -- Ok
2: Open Browser 2, login with a different user .. get a another session ID --OK
3: Refresh browser 2 --OK
4: Refresh Browser 1 -- It now have brower 2 information -- NOK
Why is it updating Browser 1? Any suggession how to fix it
Thanks for the help
I have a PHP web application that I am have some problem with keeping the session unique.
here is what is happening
1:Open Browser 1 , login .. get a session ID -- Ok
2: Open Browser 2, login with a different user .. get a another session ID --OK
3: Refresh browser 2 --OK
4: Refresh Browser 1 -- It now have brower 2 information -- NOK
Why is it updating Browser 1? Any suggession how to fix it
Thanks for the help
ASKER
Browser 1 and 2 is FF and on the same PC. I do not get this issue if the browser 1 is IE and Browser2 is FF
I am not doing any special session handling . In by bootstrap file (ZEND) I am calling the session_start() function
Thanks in advance for your help
I am not doing any special session handling . In by bootstrap file (ZEND) I am calling the session_start() function
Thanks in advance for your help
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
"If you are opening the links in the same browser with different TABS this may occur. But I don't when different browser is refreshed"
That's not the case with FF. With FF if you start a new window (not a tabbed one - CTRL-N rather than CTRL-T) the second window has access to the session established by the first window. Other browsers may vary in their behaviour.
That's not the case with FF. With FF if you start a new window (not a tabbed one - CTRL-N rather than CTRL-T) the second window has access to the session established by the first window. Other browsers may vary in their behaviour.
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Ray said: "There is no "fix" for this."
Well, there is....sort of...... but it's messy.
The solution is to embed an ID in the URL or form. You then use this identifier to access a class or array stored in the session using the URL ID as the key, but you need to encode this into everything you do. If you are security conscious then you can use PHP's mycrypt to encode/decode the value stored in the URL
Messy, but doable.
Well, there is....sort of...... but it's messy.
The solution is to embed an ID in the URL or form. You then use this identifier to access a class or array stored in the session using the URL ID as the key, but you need to encode this into everything you do. If you are security conscious then you can use PHP's mycrypt to encode/decode the value stored in the URL
Messy, but doable.
Yeah, what I really meant to convey is that there is no (easy, practical, feasible, sane, sensible, utilitarian) fix on the client side of things. And it's not really a big deal - it only seems to be troublesome to developers. How many "real-world" clients try to access your web pages from two instances of the browser with two different IDs? It just doesn't occur outside of the test environment. That's probably why PayPal and Amazon don't care about this phenomenon.
True enough - but it annoys the heck out of me.......
Me, too.
hai,
Just gothorw the session variable like
-- session_register
-- session_id
Just gothorw the session variable like
-- session_register
-- session_id
What more can you tell us?