Delete cookie

Started on the old forum in April 2012 · view the original in the archive · old links redirect here

4 replies · 415 views · started 14 years ago · 1 min read

3 participants
pmbguy Senior · 344 posts #1

Hi, im having a problem with deleting a cookie. when i set the cookie i set it for time()+3600 to set it for an hour... when i delete i set time to time()- 246060 but cookie not deleting... i tried 0 which should drop cookie when browser closes n still nothing... i am now clueless as to whats going on...

softwarefreak Senior · 349 posts #2

pmbguy wrote: Hi, im having a problem with deleting a cookie. when i set the cookie i set it for time()+3600 to set it for an hour... when i delete i set time to time()- 246060 but cookie not deleting... i tried 0 which should drop cookie when browser closes n still nothing... i am now clueless as to whats going on...

Try the time in sec, it shud work

setcookie('user', 'someone', time() - 2592000, '/');

Added after 2 minutes:

if you wana to let cookie expireswhen the browser is closed, skip the time() param

setcookie('user', 'someone');

I need some facebook likes, can you please help me 🤝 http://facebook.com/softwarefreakin I noticed social media is really powerful 🧙 Well DONE is better than well SAID

softwarefreak Senior · 349 posts #4

pmbguy wrote: you mean something like this?

$timeout = time() - (60 * 24 * 60 * 60); setcookie ("uvw999", "", $timeout "/");

Yes,

$expire = time() - 5184000;
setcookie ("uvw999", "somedata", $expire);

I need some facebook likes, can you please help me 🤝 http://facebook.com/softwarefreakin I noticed social media is really powerful 🧙 Well DONE is better than well SAID

shushant Developer · 207 posts #5

pmbguy wrote: you mean something like this?

$timeout = time() - (60 * 24 * 60 * 60); setcookie ("uvw999", "", $timeout "/");

Lets this is ur initial Cookie

$till = 5184000; 
setcookie("key", "var", $till);

to reset

$till = 100; 
setcookie("key", "gone", $till);

Sign in to reply.

Similar topics

Keyboard shortcuts

g f
Go to forums
g h
Go to your feed
g m
Go to messages
r
Reply (in a topic)
/
Search
j
Next post
k
Previous post
?
This list
Ctrl/⌘ + Enter
Send what you are writing
Ctrl/⌘ + B / I
Bold / italic while writing
Esc
Close