Site Cloner PHP Script
Bargain Hunter PHP Script
Job Hunter PHP Script
Site Login and Access Control PHP Script

PHP Cookies for Entire Domain

A problem that exists when setting cookies is accessing the cookies on various urls such as:, and

Unfortunately, if you want a cookie(s) to be accessible on all directories in the domain regardless of what is inserted into the browser, you need to set the cookie properly.

For example, if a cookie is set on a url like, it can be accessed on any other page in the domain if the address in the browser began with (ie. The code for this example is:
setcookie(“my_cookie_name”, $var, time()+ 14400, ‘/’, ‘’);

But, if you want to access the cookie no matter how the url is presented in the browser, you would use:
setcookie(“my_cookie_name”, $var, time()+ 14400, ‘/’, ‘’);

The latter code above sets a cookie called my_cookie_name that remains usable for 2 hours. If you wanted to pull the data from the cookie it would actually be the value $var.