General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here
  #1  
Old October 10th, 2002, 12:54 AM
Taelo Taelo is offline
5B's
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: PC, FL
Posts: 364 Taelo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 48 m 26 sec
Reputation Power: 6
Cookie Help

I am having problems deleting cookies...

this is how I am setting them, and this is working fine.
PHP Code:
 setcookie("cookie1",$var1,time()+((3600*24)*30),$path,$domain);
setcookie("cookie2",$var2,time()+((3600*24)*30),$path,$domain); 


This is how I am deleting them,..err trying to delete them

PHP Code:
 setcookie("cookie1"$_SESSION[var1], time()-((3600*24)*30));
setcookie("cookie2"$_SESSION[var2], time()-((3600*24)*30)); 


The cookies will not delete. I can update them with new vars with no problem, they just won't delete.

Any help is greatly appreciated.


-- Jason

Reply With Quote
  #2  
Old October 10th, 2002, 01:05 AM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
To delete cookies, you set them with a value of nothing or blank

setcookie("cookie1", $_SESSION[var1], time()-((3600*24)*30));
setcookie("cookie2", $_SESSION[var2], time()-((3600*24)*30));

wont delete them, because your setting a value, you need to do something like this

@setcookie("cookie1", , time()-((3600*24)*30));
@setcookie("cookie2", , time()-((3600*24)*30));

or

@setcookie("cookie1", 0, time()-((3600*24)*30));
@setcookie("cookie2", 0, time()-((3600*24)*30));

depends if your running it on a window or *nix server

Reply With Quote
  #3  
Old October 10th, 2002, 09:16 AM
Taelo Taelo is offline
5B's
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: PC, FL
Posts: 364 Taelo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 48 m 26 sec
Reputation Power: 6
here is what I have for my logout page,...

PHP Code:
 session_unset("var1");
session_unset("var2");
session_unset("var3");
session_unset("var4");
session_start();
session_destroy();

setcookie("cookie_var1","",time()-((3600*24)*30));
setcookie("cookie_var2","",time()-((3600*24)*30));

header("Location: index.php"); 


Cookie is still not deleting. Am I doing something wrong here?


-- Jason

Last edited by Taelo : October 10th, 2002 at 11:49 AM.

Reply With Quote
  #4  
Old October 10th, 2002, 07:00 PM
Ben Rowe
Guest
Dev Articles Newbie (0 - 499 posts)
 
Posts: n/a  
Time spent in forums:
Reputation Power:
setcookie("cookie_var1", "", time() - 3600);
setcookie("cookie_var2", "", time() - 3600);

try that, that should work, unless you have some funny options turned on your sever,

also as a security note, you shouldnt use cookies for a login area, as they are the far easiest to hack into.

Reply With Quote
  #5  
Old October 11th, 2002, 03:37 PM
Taelo Taelo is offline
5B's
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: PC, FL
Posts: 364 Taelo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 48 m 26 sec
Reputation Power: 6
well,....I don't know what I got going on here,...I can't get that cookie to delete for anything,.....

Reply With Quote
  #6  
Old October 11th, 2002, 05:24 PM
FrankieShakes FrankieShakes is offline
Frank The Tank!
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: Jun 2002
Location: Toronto, Canada
Posts: 1,246 FrankieShakes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Send a message via ICQ to FrankieShakes Send a message via MSN to FrankieShakes
Jason,

What version of PHP are you running? Do you have register_globals set on or off?

What if you were to try:

setcookie("cookie1", "", time()-((3600*24)*30), "", "");

Try resetting the path and domain as well.
__________________
____________________________________________
Developer Shed Weekly Writer | DevArticles Forum Moderator
Build Your Own KlipFolio Klip With PHP
FrankManno.com - Under Construction
Design Interactive Group - Under Construction

Reply With Quote
  #7  
Old October 11th, 2002, 05:55 PM
Taelo Taelo is offline
5B's
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Oct 2002
Location: PC, FL
Posts: 364 Taelo User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 48 m 26 sec
Reputation Power: 6
This is What I have,...logout.php

PHP Code:
 setcookie("var1","",time()-((3600*24)*30),"","");
setcookie("var2","",time()-((3600*24)*30),"","");

session_unset("var1");
session_unset("var2");
session_start();
session_destroy();

header("Location: news.php"); 


Register_globals is set to On

Can you think of anything else I might try?

-- Jason

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > Cookie Help


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway