Categories:
.NET (357)
C (330)
C++ (183)
CSS (84)
DBA (2)
General (7)
HTML (4)
Java (574)
JavaScript (106)
JSP (66)
Oracle (114)
Perl (46)
Perl (1)
PHP (1)
PL/SQL (1)
RSS (51)
Software QA (13)
SQL Server (1)
Windows (1)
XHTML (173)
Other Resources:
How To Remove a Cookie
How To Remove a Cookie? - PHP Script Tips - Understanding and Managing Cookies
✍: FYIcenter.com
Once a cookie is sent from the server to the browser, there is no direct way for the server to ask the browser to remove the cookie. But you can use the setcookie() function to send the same cookie to browser with a negative expiration time, which will cause the browser to expire (remove) the cookie immediately. The next sample PHP page will let you remove "CouponNumber" and CouponValue" persisted by the previous tutorial exercise:
<?php
setcookie("CouponNumber","",time()-1);
setcookie("CouponValue","",time()-1);
print("<pre>\n");
print("2 cookies were delivered with past times.\n");
$count = count($_COOKIE);
print("$count cookies received.\n");
foreach ($_COOKIE as $name => $value) {
print " $name = $value\n";
}
print("</pre>\n");
?>
Open your browser to visit this page: http://localhost/removing_cookies.php. You will see:
2 cookies were delivered with past times. 2 cookies received. CouponNumber = 07470433 CouponValue = 100.00
Click the refresh button, you will see:
2 cookies were delivered with past times. 0 cookies received.
As you can see, both cookies are removed.
2007-04-24, 5089👍, 0💬
Popular Posts:
What are shared (VB.NET)/Static(C#) variables? Static/Shared classes are used when a class provides ...
What are the high-level thread states? The high-level thread states are ready, running, waiting, and...
How To Set Background to Transparent or Non-transparent? - CSS Tutorials - HTML Formatting Model: Bl...
Once I have developed the COM wrapper do I have to still register the COM in registry? Yes.
Give me the example of SRS and FRS SRS :- Software Requirement Specification BRS :- Basic Requiremen...