Robot Boy
Robot Boy

Reputation: 1979

Set cookie for current directory and its subdirectories only

I have the following directories:

Company > Model > Year

I want cookies to be only set in the Model folder, not available to the Company directory but available in the year dir. The cookies I set in Model or year should be available to each other but the parent dir (Company) should not be able to see those cookies.

Its like: sub.domain.xyz/app/company/model/year/index.php

Cookie: setcookie('year', $year, time() + (86400), "/");

I do know that "/" will set the cookie for the whole domain.

Upvotes: 0

Views: 1603

Answers (1)

davestevens
davestevens

Reputation: 2323

Try setting to "/Company/Model". It's explained here: http://www.quirksmode.org/js/cookies.html under the domain and path section.

Upvotes: 1

Related Questions