Reputation: 11
Is it true that if a script sets a cookie and if the user's browser is set to not accept cookies, then the set cookie function will detect this and instead set a session?
Upvotes: 1
Views: 147
Reputation: 4484
I guess you mean the session.use_trans_sid setting:
If you set this setting: ini_set('session.use_trans_sid', 1); than PHP attaches the session ID to the URL if there are no cookies available.
Upvotes: 1
Reputation: 97845
No.
Additionaly, cookies and sessions are not directly comparable. In fact, cookies are typical part of the implementation of sessions.
You can, of course, detect if the user accepts cookies. Server-side this can be made by setting a cookie, forwarding the user and checking if the user sent the just set cookie in the new request.
Keep in mind:
Upvotes: 9