-1

What if I make cookie for my domain (www.mydomain.com) and name it "kolac" = $_COOKIE["kolac"]. But what if some other site has cookie that is named the same as mine. Is it going to replace my cookie or not? I don't understand how it works.

And one more question. What pieces of information can I store in my cookie?

FosAvance
  • 2,363
  • 9
  • 36
  • 52

1 Answers1

1

A cookie can only be set and is only accessible to the domain of the request so if there is a cookie set by a different domain with the same key as your cookie, you will not be able to access it. Also, it will not replace your cookie since those two values are stored in physically different files on your computer and can only be accessed by the domain that created the cookie.

A cookie can only store text information up to 4K for the entire cookie. You can still serialize other types of data into text, but generally you only want to store basic text values in a cookie.

Jacob VanScoy
  • 1,168
  • 6
  • 14