CodeIgniter Forums
Cookie Helper - get_cookie() prefix problem - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23)
+--- Thread: Cookie Helper - get_cookie() prefix problem (/showthread.php?tid=14668)



Cookie Helper - get_cookie() prefix problem - El Forum - 01-10-2009

[eluser]akifemre[/eluser]
Hey all,
set_cookie() and delete_cookie() functions are checking cookie prefix in arguments and config but looks like get_cookie() function don't care cookie prefix. And i edited it such.

Code:
function get_cookie ($index = '', $xss_clean = FALSE, $prefix = '')
{
    $CI = & get_instance( );
    if ( $prefix == '' and $CI->config->item('cookie_prefix') != '' )
    {
        $prefix = $CI->config->item('cookie_prefix');
    }
    return $CI->input->cookie($prefix . $index, $xss_clean);
}