Ejemplo n.º 1
0
 function _initAuth()
 {
     global $session_is_start;
     if (isset($_GET['login'], $_POST['AdmloginInput'], $_POST['AdmpasswordInput']) && isset($this->_cfg['login']['user'], $this->_cfg['login']['password'])) {
         @$this->_disable_magic_quotes_gpc();
         $_settings_login = $this->_cfg['login']['user'];
         $_settings_password = $this->_cfg['login']['password'];
         if ($_POST['AdmloginInput'] == $_settings_login && $_POST['AdmpasswordInput'] == $_settings_password) {
             $_SESSION[AP_SESS_AUTH] = @session_id();
             $this->SetAdminAccessType(AP_SESS_AUTH_TYPE_SUPER_ADMIN);
             @header('Location: ' . AP_INDEX_FILE . '?enter');
             exit;
         } else {
             if (strlen(AP_DEMO_LOGIN) > 0 && $_POST['AdmloginInput'] == AP_DEMO_LOGIN) {
                 $_SESSION[AP_SESS_AUTH] = @session_id();
                 $this->SetAdminAccessType(AP_SESS_AUTH_TYPE_SUPER_ADMIN_ONLYREAD);
                 @header('Location: ' . AP_INDEX_FILE . '?enter');
                 exit;
             } else {
                 if ($this->PType()) {
                     if (is_array($this->_main_all)) {
                         foreach ($this->_main_all as $_plugins) {
                             if ('cm' === $_plugins->GetIndex()) {
                                 $domains = $_plugins->GetSubAdminDomainsIdsByLoginPassword($_POST['AdmloginInput'], $_POST['AdmpasswordInput']);
                                 if ($domains) {
                                     $_SESSION[AP_SESS_AUTH] = @session_id();
                                     $this->SetAdminAccessType(AP_SESS_AUTH_TYPE_SUBADMIN);
                                     $this->SetAdminAccessDomains($domains);
                                     @header('Location: ' . AP_INDEX_FILE . '?enter');
                                     exit;
                                 }
                             }
                         }
                     }
                     @session_destroy();
                     @header('Location: ' . AP_INDEX_FILE . '?auth_error');
                     exit;
                 } else {
                     @session_destroy();
                     @header('Location: ' . AP_INDEX_FILE . '?auth_error');
                     exit;
                 }
             }
         }
     } else {
         if ($session_is_start) {
             if (CAdminPanel::IsStaticAuth() && isset($_SESSION[AP_SESS_AUTH_TYPE])) {
                 $this->SetAdminAccessType((int) $_SESSION[AP_SESS_AUTH_TYPE]);
             }
         } else {
             $this->_ge(ap_Utils::TakePhrase('AP_LANG_SESSION_ERROR'));
             @session_destroy();
         }
     }
 }