calvin182 Posted March 18, 2006 Share Posted March 18, 2006 I've figured out how to set a cookie using php but I want to set up a link to remove that cookie. Some help please? Link to comment Share on other sites More sharing options...
scott100 Posted March 18, 2006 Share Posted March 18, 2006 I've figured out how to set a cookie using php but I want to set up a link to remove that cookie. Some help please?<{POST_SNAPBACK}> If you send a cookie that consists of a name without a value, it will have the same effect as deleting the existing cookie of the same name.Examplecreate a cookie called usernamesetcookie('username','scott'); to deletet the cookie called username setcookie('username',''); As an added precaution, you can also set an expiration date that's in the past setcookie('username','',time()-60); Link to comment Share on other sites More sharing options...
calvin182 Posted March 19, 2006 Author Share Posted March 19, 2006 thanks, that doesnt exactly remove the cookie but that helped out Link to comment Share on other sites More sharing options...
scott100 Posted March 19, 2006 Share Posted March 19, 2006 thanks, that doesnt exactly remove the cookie but that helped out <{POST_SNAPBACK}> I know that's just the way php does it, there is no such thing as removecookie('username',''); Link to comment Share on other sites More sharing options...
Armed Rebel Posted March 19, 2006 Share Posted March 19, 2006 It removes the cookie.Means to an end. Link to comment Share on other sites More sharing options...
calvin182 Posted March 19, 2006 Author Share Posted March 19, 2006 you would think php would have a way to actually delete cookies considering it has a way to set them instead of just nullifying it. I see IPB has a link on it saying 'delete coookies set by this board' which leads me to consider the possibility that maybe javascript can do this? any thoughts? it's not completely neccessary anymore, I guess nullifying it will do fine, but I am a bit currious. Link to comment Share on other sites More sharing options...
scott100 Posted March 19, 2006 Share Posted March 19, 2006 JavaScript and ASP are the same, to remove a cookie set an expiration date in the past.It must be how it's done. Link to comment Share on other sites More sharing options...
calvin182 Posted March 19, 2006 Author Share Posted March 19, 2006 (edited) setting an expiration date in the past (like the method you posted above) didn't work for me, the cookie was still present. I'll try again tho because I changed some thing before hand and I might have messed it up.EDIT: I tried again and it worked! I forgot to include some variables the first time hehe but that method has completely removed the cookie, thanks alot! Edited March 19, 2006 by calvin182 Link to comment Share on other sites More sharing options...
scott100 Posted March 19, 2006 Share Posted March 19, 2006 no worries Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now