cookie problem
Posted: Tue May 11, 2004 11:27 am
hi everyone,
i am a newbie in php and facing a problem regarding cookies.
i have following settings in my php.ini file:
session.save_path = "C:\Program Files\Apache Group\Apache2\htdocs\tmp"
session.use_cookies = 1
session.cookie_lifetime = 0
session.cookie_path = "C:\Program Files\Apache Group\Apache2\htdocs\cookies"
session.cookie_domain =
Earlier i had session.cookie_path = / ------default value, i changed it to the above mentioned cookies directory which is mentioned above.
i dont know where is the default value for / session.cookie_lifetime = session.cookie_lifetime = / / pointing towards.
now i am writing following code:
<?php
session_start();
$val = setcookie("test_cookie","hello");
if($Val == TRUE)
echo "cookie set<br>";
else
echo "problem setting cookie";
$cookie_val = $_COOKIE['test_cookie'];
echo $cookie_val;
?>
i get the output cookie set
hello
now when i go to cookie tmp directory according to the:
session.save_path = "C:\Program Files\Apache Group\Apache2\htdocs\tmp" ---- i get the files having names like session ids (sess_20d809b36ece8a6c85ebd706532ddefc) when i double click the file and open with notepad i dont get the value which i had set using the setcookie function (i.e. hello).
plz help me knowing how can i access cookies, where are they stored as i do not get any thing in cookies directory which i created for session.cookie_path setting.
why am i not getting the hello value for cookie in the tmp directory session file.
Thank you
Gaurav
i am a newbie in php and facing a problem regarding cookies.
i have following settings in my php.ini file:
session.save_path = "C:\Program Files\Apache Group\Apache2\htdocs\tmp"
session.use_cookies = 1
session.cookie_lifetime = 0
session.cookie_path = "C:\Program Files\Apache Group\Apache2\htdocs\cookies"
session.cookie_domain =
Earlier i had session.cookie_path = / ------default value, i changed it to the above mentioned cookies directory which is mentioned above.
i dont know where is the default value for / session.cookie_lifetime = session.cookie_lifetime = / / pointing towards.
now i am writing following code:
<?php
session_start();
$val = setcookie("test_cookie","hello");
if($Val == TRUE)
echo "cookie set<br>";
else
echo "problem setting cookie";
$cookie_val = $_COOKIE['test_cookie'];
echo $cookie_val;
?>
i get the output cookie set
hello
now when i go to cookie tmp directory according to the:
session.save_path = "C:\Program Files\Apache Group\Apache2\htdocs\tmp" ---- i get the files having names like session ids (sess_20d809b36ece8a6c85ebd706532ddefc) when i double click the file and open with notepad i dont get the value which i had set using the setcookie function (i.e. hello).
plz help me knowing how can i access cookies, where are they stored as i do not get any thing in cookies directory which i created for session.cookie_path setting.
why am i not getting the hello value for cookie in the tmp directory session file.
Thank you
Gaurav