1. 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?

Discussion in 'XenForo Questions and Support' started by Matthew Hawley, Mar 13, 2013.

  1. Matthew Hawley

    Matthew Hawley Well-Known Member

    Im trying to integrate a chat system with XenForo. It says I need the session or other cookie set by xenforo.
     
  2. Jake Bunce

    Jake Bunce XenForo Moderator Staff Member

  3. cclaerhout

    cclaerhout Well-Known Member

    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'$datas86400 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);
    }
    
     
    Sadik B and Jake Bunce like this.

Share This Page