Jump to content

session cookie


werty37

Recommended Posts

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 sessions
have 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
Link to comment
Share on other sites

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)?
Link to comment
Share on other sites

HI
So 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 advance
werty37
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.