PHP

Topic: Sessions

How To Force the PHP Engine to Use Cookies to Transfer Session IDs?

If you want to force your PHP engine to use cookies to transfer session IDs instead of URL parameters, you can open the PHP configuration file, php.ini, and make the following changes:session.use_cookies = 1session.use_only_cookies = 1Now re-run the first_page.php and next_page.php scripts presented in the previous tutorials. You will get something like:Query string of the incoming URL: Cookies received:  PHPSESSID = r66hq1bcg8o79e5i5gd52p26g3Value of MyLogin has been retrieved: FYICenterValue of MyColor has been retrieved: BlueBase on the output, your PHP engine is using cookies to transfer session IDs now, because you can see the cookie named as PHPSESSID contains the session ID, there is no URL parameters related to session ID.

Browse random answers: