• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

XF 1.1 Session or Cookie set?

cclaerhout

Well-known member
#3
I'm not sure if it can help you, but here is a few examples on how to set/get cookie with XenForo

PHP
PHP:
$getCookie = XenForo_Helper_Cookie::getCookie('cookieName');

if($getCookie == false)
{
    //No cookie => Create Cookie
    XenForo_Helper_Cookie::setCookie('cookieName', $datas, 86400 * 365);
}

JavaScript
Code:
if($.getCookie('cookieName') == false)
{
    //Date Expiratation
    var expires = 90; // number of days
    expires = new Date(new Date().getTime() + expires * 86400000); // milliseconds in a day

    $.setCookie(cname, 'cookieName', expires);
}