i want to access the cookies on sub domain,
the cookies working on main domain well but can't able to access the cookie on subdomain, i created two files testing_1.php and testing_2.php, the cookies is set through testing_1.php that is
$domain = '.localhost';
session_set_cookie_params(0, '/', $domain);
session_start();
$_SESSION['name'] = 'Jogesh';
setcookie("f_name", "jogesh", 0, "/", "$domain");
if( isset( $_COOKIE["f_name"] ) )
echo "Set Cookie on 1: " . $_COOKIE["f_name"];
else
var_dump(setcookie("f_name", "jogesh", 0, "/", "$domain"));
in the above code i also try to access session, but just got the session id, i want to access $_SESSION['name']
on subdomain if possible other wise cookies
now the testing_2.php is here
session_start();
if( isset( $_SESSION['name'] ) )
echo "Session Name: " . $_SESSION['name'];
else
echo "Session not set!";
if( isset( $_COOKIE["f_name"] ) )
echo "Cookie Name: " . $_COOKIE["f_name"];
else
echo "Cookie not set!";
the both files working well on localhost
but when i am trying to access the file testing_2.php from demo.localhost
the can't access anything plz let me know what mistake i had done,,