Log in

View Full Version : May delete ALL PHP Cookies or JAVASCRIPT Cookies with one command, one visit to a par



leonidassavvides
11-06-2009, 11:01 AM
May delete ALL PHP Cookies or JAVASCRIPT Cookies with one command, one visit to a particular page (for developer/debugging)?

Schmoopy
11-06-2009, 05:49 PM
You really need to try and explain yourself better, I don't have a clue what you mean. What is the question or the problem you're having?

Have you gone to a site that's deleted all your cookies? Do you want to make a page that deletes all the user's cookies? Or what?

Please try and make sense when posting. A lot of your posts seem to have just random words thrown together.

leonidassavvides
11-06-2009, 06:01 PM
May delete ALL PHP Cookies or JAVASCRIPT Cookies with one command, NOT A SEPARATE COMMAND FOR EACH COOKIE CREATED ? I AM WEB DEV ...

Schmoopy
11-06-2009, 06:22 PM
I rest my case...

leonidassavvides
11-06-2009, 06:51 PM
we use setcookie(to old date) in js for each(many commands), may do ALL WORK(DELETE ALL SITE'S COOKIES FOR A USER) With one command ?

djr33
11-07-2009, 12:06 AM
No. There is not one command that deletes all the cookies.
You can gather a list of all the cookies and then delete them individually.


$cs = $_COOKIE;
foreach ($cs as $cname=>$cvalue) {
setcookie($cname,'',time()-3600);
}

leonidassavvides
11-07-2009, 10:35 AM
what about javascript ....if the same , I use same method to delete ? yes / no

leonidassavvides
11-09-2009, 11:12 AM
php: $cs = $_COOKIE; // in javascript we have any var to be an array of cookies ?

leonidassavvides
11-10-2009, 06:38 PM
$cs = $_COOKIE;
foreach ($cs as $cname=>$cvalue) {
setcookie($cname,'',time()-3600);
}

with this I delete and javascript cookies along with php cookies??

Schmoopy
11-10-2009, 06:46 PM
The cookies aren't separate to the two languages. It's just two different ways of doing the same thing.
The way mentioned above is how to delete cookies in PHP, but you could also do the same by using JavaScript, it doesn't change the outcome.

Summary: It doesn't matter which language you use, JavaScript, or PHP, they are both capable of deleting the user's cookies.

leonidassavvides
11-10-2009, 07:01 PM
well, in javascript there is array of cookies like PHP's : $_COOKIE; ? so use a script for mass removal of cookies ?

Schmoopy
11-10-2009, 07:07 PM
The script that djr33 has put up should do the trick, I guess it's not imperative that the script only has one command. It should accomplish the same thing.

leonidassavvides
11-10-2009, 08:52 PM
if i have javascript and not php or other lang?

Schmoopy
11-10-2009, 09:04 PM
For the answer to that, either get a moderator to move this to the JavaScript section, or start a new topic. I'm not too good with that stuff, unless anyone else wants to give a helping hand...?

djr33
11-11-2009, 01:06 AM
setcookie() is a javascript function also. You can use this in approximately the same way.


http://www.elated.com/articles/javascript-and-cookies/
About halfway down that page:
var x = document.cookie;
"username=John; password=abc123"


However, you need to learn to post once and wait for an answer, and to make it clearer what you want.

If you are having a problem with making your thoughts clear in English, you can post both languages (English, and your first language). This may help, if someone understands what language you are posting or if we can use a translator to get more information than just the English. (But DO keep posting in English because that will be more clear to more people.)

leonidassavvides
11-11-2009, 06:38 AM
document.cookie; is a cookie array ?

djr33
11-11-2009, 07:30 AM
Read the link. The information is there.