[eluser]louis w[/eluser]
Even better yet you should set the cookie_path in the config. By default this will be "/". If you have two sites on the same domain a cookie path of / will make the cookies available to both. Normally you set a cookie path to the sub directory your site is in and the cookies will only be available to scripts in that directory. This is built in cookie security.
I dynamically populate this with the directory my index.php resides in.
Code:
// Index.php:
define('SITEPATH', (dirname($_SERVER['SCRIPT_NAME']) == '/') ? '/' : dirname($_SERVER['SCRIPT_NAME']).'/');
// config.php
$config['cookie_path'] = SITEPATH;
Having a variable containing the working directory of my site (SITEPATH) comes in very handy.