We launched new forums in March 2019—join us there. In a hurry for help with your website? Get Help Now!
    • 36756
    • 7 Posts
    Hi everybody,

    if have a problem with user sessions in MODX Revolution. The session seems to be killed every 1-2 hours.

    Detailed information
    I wrote this plugin:
    ?php
    if ((($modx->getOption('http_host')) == 'subdomain.domain.de') && ($modx->resource->get('id') != 67)) {
      $session = $modx->checkSession('subdomain');
      if(!$session) {
        $userid = $modx->user->get('id');
        if (!$userid) {
          $url = $modx->makeUrl(67);
          $output = $modx->sendRedirect($url);
          return $output;
          break;
        }
      }
    }
    

    Fires on event: OnLoadDocument

    Page ID 67 is the login-page, it is located in the "subdomain" context. After the login, the user gets redirected to the context startpage, that works fine.

    The cookie is set to a one week lifetime. "Remember me" is set, too.

    Is there a better way to do session authentication? Does somebody see my mistake? Please help.

    Thank you
    strochli