workaround for sessions on cookie disabled machines in php

Share this Article :


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);

Written by adrevol

{adrevol has written 91 posts on ITTreats.com . See all posts by }


Leave a Reply