I have a cookie that is set by xxx.com. I would like a php script running in me.com to remove a particular cookie set by xxx.com.

This is the code that I am using to remove that cookie:

$test=setcookie('COOKIENAME','',0,'/','.xxx.com');

$test returns true, but the browser (FireFox) does not show the cookie as having been removed.

I have tried setting the expiration time of the cookie to some time in the past, still no go.

As far as i can tell, i have the parameters correst based on looking at the details of the cookie by looking at FireFox's cookie display options.

Am I doing something wrong, or is it just not possible for me to remove this cookie from within my domain.

    For security reasons it isn't possible to remove a cookie from another domain.

      How about using java script? ( yes - I know this is a php site.... 🙂 )

        You won't be able to use Javascript to do this as browsers simply will not allow one domain to tinker with another domain's cookies (by any means). Would you want any random xxx.com you visit being able to tinker with your yyy.com cookies?

        If you need to pass cookie data between two sites you could url encode the data and pass it in a URL link between the two sites maybe. Encrypt it if need be.

          OK - that's what I thought. I know that FireFox cookie manage allows deletion of a cookie, but that us under local user control. Guess I'll have to try my hand at writing an extension.

          Thanks for the help!

            Umm... before you write that extension... are you talking about writing something that will be used by lots of different people who visit your web site? Or are you talking about something that you want to personally run on your own computer because you're sick of domain xxx.com setting cookies on your machine?

            If it's the second one, you can simply block cookies from that domain permanently... or you can do what I do which is to:

            A) Accept cookies from everyone but force them to expire at the end of the session and then
            😎 Create exceptions for sites whose cookies are Ok to be permanent (Google, Amazon, PHPBuilder, etc).

              Actually perhaps a bit of both. I am farming information from a game - harvesting country information using a combo of user js and php. The game sets a cookie that seems to only allow 200 countries be harvested before it stops working. Removing just that one cookie prevents the 200 country limit.

              My php script basically would remove the cookie say every 50 or 100 countries processed.

              Right now it would be personal to me. But I can see this script being used by other members of my team.

              Removing all cookies for that particular site would not be a solution as that would log me out of the game.

                I hope they discover that you're cheating, permanently ban your account AND fix the bug.

                Mark

                  MarkR wrote:

                  I hope they discover that you're cheating, permanently ban your account AND fix the bug.

                  Mark

                  This is not cheating as it is not "playing" the game. One could be very technical and say it is, but in this particular game, it is common knowledge that there are may such scripts harvesting data. The script brings up an information page, catures the data that is in the page and saved it into a database - no different than by doing it manually.

                  Besides, your post does not do anything to move forward the discussion of the programming question that I have. Or does this board require that the intended use of the application be justified in the eyes of it's members in order for a question be considered?

                    So if everyone else is doing it then it is ok? Face it, you try to cheat.

                    Just play the game as it is intended to be played, or leave the game alone. You don't only show your poor judgement by cheating, you take the fun out of others as well.

                      OK - then when does it become 'cheating'? Is it cheating to manually maintain the information on paper? Afterall, that is a method that is not provided by the game. No? How about using copy and past to maintain that in a spreadsheet or database?

                      How about using a spreadsheet to help in conputation to determin what to buy and sell within the game. Is that cheating? There are no calculators provided in the game.

                      Is chatting with team members using chat cheatingif game does not have an ingame chat? Where do you draw the line? Or are you guys so pure that you don't even consider those things? I doubt it.

                        Write a Reply...