Hi.

I have multi-language functionality on my page, and the settings are saved in a cookie, so that the user may change something different than his browser language.

But this is whats happening:

/home.php?setlanguague=en
The page shows it's text in English, and prints my user info aswell as the content of the language cookie, which is "en".

/admin/users.php
The page shows in my browser language. Meaning the set language from /home.php haven't persisted.

/home.php
The page still shows in English.

So basically as I navigate around my site, as soon as the page is in another dir, the cookie is unique for that dir.

Hope this explanation is possible to understand.

So, why does this happen? I thought cookies were domain specific?
How do I solve this? Links are fine.

Reading the documentation works for me! From the PHP manual:

path
The path on the server in which the cookie will be available on. If set to '/', the cookie will be available within the entire domain . If set to '/foo/', the cookie will only be available within the /foo/ directory and all sub-directories such as /foo/bar/ of domain . The default value is the current directory that the cookie is being set in.

Ahh haha, you got me there, silly me ;)
I thought it would be some server configuration or something.

Well thank you very much! :D

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.