Hi all,

Please tell me where is the cookie file stored in my computer when i run the below codes..
I checked it in the C:\

<?php
setcookie("test","john_joseph",time()+ 3600);
?>
<html>
<body>
<form name="cookie" method="post" action="<?php echo $_server['php_self'];?>">
Enter ur name:<input type="text" name="name">
<input type="submit" name="submit" value="SUBMIT">
  </form>
<?php
if (isset($_COOKIE["test"]))
  echo "Welcome " . $_COOKIE["test"] . "!<br />";
else
  echo "Welcome guest!<br />";
?></body>
</html>

Thanks in advance

Recommended Answers

All 3 Replies

That depends on you browser, of course. In IE (I just can guess) it is stored in Windows\Temp in a normal textfile. Opera saves all cookies in one file but but you can edit the cookies within the settings.
Firefox, Safari, Konqueror, etc save the cookies somehow else. But as I'm not using these, I don't know exactly how it works. You have to try out. Set a cookie and then use the Windows-Search-function to scan all files on your harddisk that may have stored the data from your cookie.

for i.e7 C:\Documents and Settings\username\Local Settings\Temporary Internet Files

Hi all,

Please tell me where is the cookie file stored in my computer when i run the below codes..
I checked it in the C:\

<?php
setcookie("test","john_joseph",time()+ 3600);
?>
<html>
<body>
<form name="cookie" method="post" action="<?php echo $_server;?>">
Enter ur name:<input type="text" name="name">
<input type="submit" name="submit" value="SUBMIT">
</form>
<?php
if (isset($_COOKIE["test"]))
echo "Welcome " . $_COOKIE["test"] . "!<br />";
else
echo "Welcome guest!<br />";
?></body>
</html>

Thanks in advance

It depends on the HTTP client you use. Different web browsers store cookies in different locations, and in different formats.
TXT based HTTP clients such as CURL, or Linx, will save it somewhere else. etc.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.