[eluser]Lockzi[/eluser]
[quote author="WanWizard" date="1287080532"]I use this:
Code:
// determine the domain and the path from the base_url
$base_url_parts = parse_url($config['base_url']);
$config['cookie_domain'] = $base_url_parts['host'];
$config['cookie_path'] = $base_url_parts['path'];
unset($base_url_parts);
This also sets the path right if you haven't installed the application in the website docroot, but in a directory...[/quote]
Yours didn't work for me at all...
Code:
Notice: Undefined index: path in /home/auinterface/public_html/application/config/config.php on line 257
A PHP Error was encountered
Severity: Notice
Message: Undefined index: path
Filename: config/config.php
Line Number: 257
The reason is that my $base_url_parts only exists of:
Code:
Array ( [scheme] => http [host] => subdomain.domain.se ) 1
You need to set path to '/' as default in case of the application actually is in the web root.
This would be a solution:
Code:
// determine the domain and the path from the base_url
$base_url_parts = parse_url($config['base_url']);
if(!key_exists('path', $base_url_parts))
{
$base_url_parts['path'] = '/';
}
die(print_r($base_url_parts));
$config['cookie_domain'] = $base_url_parts['host'];
$config['cookie_path'] = $base_url_parts['path'];
unset($base_url_parts);
But I really rather go with mine in that case...
EDIT:
I just realized a huge problem... I'm not ending the $config['base_url'] with /.
Thanks for allowing me to find that problem