werty37 Posted May 30, 2006 Share Posted May 30, 2006 Hi[code]<?php ob_start('ob_gzhandler');if (!isset($_COOKIE['PHPSESSID'])) { session_start();ob_flush(); if (!isset($_COOKIE['PHPSESSID'])) { echo "Cookies are disabled."; }else { echo session_id(); }}ob_flush();?>[/code]ok, i want to know how i can access my phpcookie, since all the people who use php with sessionshave a PHPSESSID.lets say for example- your site uses php -session enabled, and my site uses the same, if a visitor vists your site and my site at the same time, how can i access only my PHPSESSID cookie and not yours.Hope i am making it clear...Thanks in advance Quote Link to comment https://forums.phpfreaks.com/topic/10788-session-cookie/ Share on other sites More sharing options...
poirot Posted May 30, 2006 Share Posted May 30, 2006 PHP will access only the cookie from your site, because it's sent from the client. The client should send the correct cookie; otherwise it could be a major security risk, don't you think (you'd be able to steal ppl's cookies)? Quote Link to comment https://forums.phpfreaks.com/topic/10788-session-cookie/#findComment-40325 Share on other sites More sharing options...
werty37 Posted May 30, 2006 Author Share Posted May 30, 2006 So i really dont have to check that the cookie is from my site or not unlike normal cookies. Quote Link to comment https://forums.phpfreaks.com/topic/10788-session-cookie/#findComment-40331 Share on other sites More sharing options...
werty37 Posted May 30, 2006 Author Share Posted May 30, 2006 HISo i have a problem with this code. it always prints "Cookies are disabled."on first request even though i flush the buffer to the client.Secondly, when i check the cookie details in the browser,i can see that session_set_cookie_params() did not work.What is wrong?[code]<?php ob_start('ob_gzhandler'); session_start();if (!isset($_COOKIE['PHPSESSID'])){session_set_cookie_params("3600","/test","localhost","0");session_start();ob_flush();if (!isset($_COOKIE['PHPSESSID'])) { echo "Cookies are disabled."; }}else { echo session_id(); }//ob_flush();?>[/code]Thanks in advancewerty37 Quote Link to comment https://forums.phpfreaks.com/topic/10788-session-cookie/#findComment-40346 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.