Example #1
0
 /**
  * Is there a cookie for AutoLogin ??
  */
 public function checkAutoLogin($forReal = true)
 {
     if (empty($_COOKIE['auto_login'])) {
         return false;
     }
     $arrVal = explode(":", $_COOKIE['auto_login']);
     $id = VarUid::sani($arrVal[0]);
     $salt = VarStr::sani($arrVal[1]);
     if (!$id || !$salt) {
         return false;
     }
     if ($this->obj->load($this->obj->dbUid(true) . "='" . $id . "' AND " . $this->obj->dbField('salt', $salt) . " AND " . $this->obj->dbField('auto_login', 1) . " AND " . $this->obj->dbField('enabled', 1))) {
         if (!$forReal) {
             return true;
         }
         setCookie('auto_login', $this->obj->getUid() . ":" . $this->obj->get('salt'), time() + 3600 * 24 * 30);
         $this->_activateLogin();
         return true;
     } else {
         return false;
     }
 }