A Friend in Need is a Friend in Deed.
Become a Member at ITTreats.com !! Share Your invaluable Experience to Fellow Programmers. Signup, Start Blogging and support fellow Techies.

workaround for sessions on cookie disabled machines in php

In PHP, Will sessions work on cookies disabled  Computers ?

The answer is   “NO”.

because,

Server cookie is a session or we can say that session is also a cookie on the server.

For session to work, cookies on server as well as on client browser should be enabled.

We can also make session working without cookies enabled on the client browser by URL session passing.

to append  this session id to every link in page  we can use

“session.use_trans_sid” in php.ini

set session.use_trans_sid  to 1 in php.ini

So,  the work around to sessions work on cookie disabled machies is as follows

just add this two lines of code before session_start() on each page ..

//  here is the code
if (!$_SESSION)
ini_set("session.use_trans_sid",1);

Article Written by : adrevol
( Articles Submitted : 47 Articles Commented : )




Leave a Reply