Check if session has started

Discussion in 'Extensions' started by assuncao, Aug 1, 2018.

  1. assuncao

    assuncao Member

    Joined:
    Aug 17, 2016
    Messages:
    55
    Likes Received:
    7
    S.E:
    Expired
    L.T:
    Regular
    L.C:
    1
    Hi,
    I created new reports that queries directly the database. I would like to use the same session, I don't want to create a new login for these pages. Unfortunatelly when I try to dump the $_SESSION variable, nothings shows up.
    Could someone give a hint how can I check if the person is already logged? My report does not use any framework.
    Thank you!
     
  2. twisted1919

    twisted1919 Administrator Staff Member

    Joined:
    Dec 27, 2014
    Messages:
    10,254
    Likes Received:
    2,382
    Where are your custom files located in relation to mailwizz ?
     
  3. assuncao

    assuncao Member

    Joined:
    Aug 17, 2016
    Messages:
    55
    Likes Received:
    7
    S.E:
    Expired
    L.T:
    Regular
    L.C:
    1
    Mailwizz is at /public_html/
    My custom files is at /public_html/custom_report/
     
  4. twisted1919

    twisted1919 Administrator Staff Member

    Joined:
    Dec 27, 2014
    Messages:
    10,254
    Likes Received:
    2,382
    Well, while it is not advisable, what you could do, is to get an instance of the app in your custom file(s):
    PHP:

    define
    ('MW_RETURN_APP_INSTANCE'true);

    // define the type of application we are creating.
    define('MW_APP_NAME''customer');

    // and start an instance of it.
    require_once(dirname(__FILE__) . '/../apps/init.php');

    // now Yii::app() is available.
    if (Yii::app()->customer->isGuest) {
       
    // this guy is a guest.
    }
     
  5. assuncao

    assuncao Member

    Joined:
    Aug 17, 2016
    Messages:
    55
    Likes Received:
    7
    S.E:
    Expired
    L.T:
    Regular
    L.C:
    1
    A-M-A-Z-I-N-G! That's exactly what I needed. Thank you again!
     

Share This Page