A programmer's paradise created by the twist of deliberated fantasies, and actions of a determined imagination.
Follow ME:
Our world is now compressed, made tiny, and is traveling inside its axis called the "network". Her images are displayed in the screen of a PC monitor, and inside, people can meet there ... Through my programs and applications.

Add to Google
Verification Code
Verification Code / Security Code or similar to the CAPTCHA Project. With PHP GD Library, you can create a verification code to verify access o ...

Limiting a Cookie's availability on specific directories

Platform: XAMPP in windows' Localhost (
Limiting a Cookie's availability on specific directories.

If you want to set a cookie which is only accessible to a specific directory then
you cannot just write the example code shown below:
setcookie('mydir_cookie_only', 'Acess OK', time() + 3600, '/mydir/');
Do this instead:
setcookie('mydir_cookie_only', 'Acess OK');
setcookie('mydir_cookie_only', 'Acess OK', time() + 3600);
setcookie('mydir_cookie_only', 'Acess OK', time() + 3600, '/mydir/');
You need to extract the code and call it inside that directory. In our example, the directory is named mydir. So the code should be written in a PHP script inside mydir before executing it. If you fail to execute the code inside mydir then even in the presence of the path specification, the Cookie variable will be still accessible outside the specified directory.