Reputation: 340
A PHP ERROR was encountered in the mean time of the logout process. Login & logout process it still working fine! But it shows an error when i logout the system! Severity: Warning Message: Cookie names must not be empty Filename: core/Input.php Line Number: 286
Here is the code of my Input.php set_cookie function:
function set_cookie($name = '', $value = '', $expire = '', $domain = '', $path = '/', $prefix = '', $secure = FALSE)
{
if (is_array($name))
{
// always leave 'name' in last place, as the loop will break otherwise, due to $$mill
foreach (array('value', 'expire', 'domain', 'path', 'prefix', 'secure', 'name') as $mill)
{
if (isset($name[$mill]))
{
$$mill = $name[$mill];
}
}
}
if ($prefix == '' AND config_mill('cookie_prefix') != '')
{
$prefix = config_mill('cookie_prefix');
}
if ($domain == '' AND config_mill('cookie_domain') != '')
{
$domain = config_mill('cookie_domain');
}
if ($path == '/' AND config_mill('cookie_path') != '/')
{
$path = config_mill('cookie_path');
}
if ($secure == FALSE AND config_mill('cookie_secure') != FALSE)
{
$secure = config_mill('cookie_secure');
}
if ( ! is_numeric($expire))
{
$expire = time() - 86500;
}
else
{
$expire = ($expire > 0) ? time() + $expire : 0;
}
setcookie($prefix.$name, $value, $expire, $path, $domain, $secure);
}
Line Number: 286
setcookie($prefix.$name, $value, $expire, $path, $domain, $secure);
Upvotes: 0
Views: 2599
Reputation: 4532
Notes :
For site-wide cookies regardless of how your site is requested, add your URL to the domain starting with a period, like this: .your-domain.com
$cookie = array(
'name' => 'demo',
'value' => 'Hello i m cookies which saved in this broswer',
'expire' => '86500',
'domain' => 'yourdomain', // in localhost this should be null
'path' => '/',
'prefix' => 'myprefix_',
'secure' => TRUE );
$this->input->set_cookie($cookie);
Discrete Parameters
If you prefer, you can set the cookie by passing data using individual parameters:
$this->input->set_cookie($name, $value, $expire, $domain, $path, $prefix, $secure);
Upvotes: 1