Log in

View Full Version : avoiding cookies



d-machine
03-30-2010, 10:19 AM
Hi,

I have one php page in my site, and I don't want it to keep cookies,
so on every new load of the page all the content will load over new.

How can I do it?

Thanks

bluewalrus
03-30-2010, 01:35 PM
It's not using cookies unless you've told it too. It's probably caching




<HTML><HEAD>
<META HTTP-EQUIV="Pragma" CONTENT="no-cache">
<META HTTP-EQUIV="Expires" CONTENT="-1">
</HEAD><BODY>
</BODY>
</HTML>


http://support.microsoft.com/kb/234067

or



<?php
header("Cache-Control: no-cache");
header("Pragma: no-cache");
?>
<html>
<head>
</head>
<body>
</body>
</html>

d-machine
03-30-2010, 03:16 PM
Hi, thanks, nice to learn something new :)

djr33
03-30-2010, 05:24 PM
If you want to clear cookies, then you can do it like this:
1. Loop through the array $_COOKIE
2. For each entry, set it to '' (blank) and set the expiration date in the past-- in other words delete the cookie, but there is no direct way to delete (removing the value and setting the data in the past is the standard method).

If you have already solved your initial problem, then this post is not needed, but it might be worthwhile in other cases.