Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Beginning PHP
|
Beginning PHP Beginning-level PHP discussions. More advanced coders should post to the Pro PHP forum.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Beginning PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old March 12th, 2010, 11:11 AM
Authorized User
 
Join Date: Mar 2009
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to delete all cookies

Dear all,

how to clear all cookies when user close the browser using php.

Please help me.


Thanks,
Thava
 
Old March 12th, 2010, 07:40 PM
Authorized User
 
Join Date: Nov 2009
Posts: 22
Thanks: 1
Thanked 3 Times in 3 Posts
Send a message via Yahoo to msherburne84
Default

Why do you need to delete all the cookies when the browser closes? It sounds like you should be using sessions instead of cookies. If you don't want the server to remember its clients a session would work great because it is only valid for as long as the browser is open or a predetermined time. Still don't know why you want to delete the cookies.

Have a solution if you need it. In order to delete a cookie you need to expire that cookie.

setcookie('nameOfCookie', 'valueOfCookie', time() - 3600);

the code above will expire a cookie making it unusable.

Last edited by msherburne84; March 12th, 2010 at 08:19 PM..
 
Old March 22nd, 2010, 03:51 AM
Authorized User
 
Join Date: Mar 2009
Posts: 30
Thanks: 0
Thanked 0 Times in 0 Posts
Default how to delete all cookies

hi msherburne,

get to know only i asked..
Thanks for ur reply...its working...

Thanks,
Thava





Similar Threads
Thread Thread Starter Forum Replies Last Post
Unable to delete file System.IO.Delete error maricar C# 13 March 14th, 2014 06:50 AM
php/mysql delete button and delete query dungey PHP Databases 17 April 11th, 2009 12:24 PM
how to delete a row when click delete hyperlink naveenkumarg1 Pro JSP 1 August 16th, 2004 01:29 AM
delete cookies collie Classic ASP Basics 1 November 11th, 2003 09:26 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.