当前位置: 首页>>代码示例>>PHP>>正文


PHP cmsUser::sessionUnset方法代码示例

本文整理汇总了PHP中cmsUser::sessionUnset方法的典型用法代码示例。如果您正苦于以下问题:PHP cmsUser::sessionUnset方法的具体用法?PHP cmsUser::sessionUnset怎么用?PHP cmsUser::sessionUnset使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在cmsUser的用法示例。


在下文中一共展示了cmsUser::sessionUnset方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: run

 public function run()
 {
     if (cmsUser::isLogged()) {
         $this->redirectToHome();
     }
     $email = $this->request->get('login_email');
     $password = $this->request->get('login_password');
     $remember = (bool) $this->request->get('remember');
     $back_url = $this->request->has('back') ? $this->request->get('back') : false;
     $is_site_offline = !cmsConfig::get('is_site_on');
     if ($this->request->has('submit')) {
         $is_captcha_valid = true;
         if (cmsUser::sessionGet('is_auth_captcha') && $this->options['auth_captcha']) {
             $is_captcha_valid = cmsEventsManager::hook('captcha_validate', $this->request);
         }
         if ($is_captcha_valid) {
             cmsUser::sessionUnset('is_auth_captcha');
             $logged_id = cmsUser::login($email, $password, $remember);
             if ($logged_id) {
                 if ($is_site_offline) {
                     $userSession = cmsUser::sessionGet('user');
                     if (!$userSession['is_admin']) {
                         cmsUser::addSessionMessage(LANG_LOGIN_ADMIN_ONLY, 'error');
                         cmsUser::logout();
                         $this->redirectBack();
                     }
                 }
                 cmsEventsManager::hook('auth_login', $logged_id);
                 $is_back = $this->request->get('is_back');
                 if ($is_back) {
                     $this->redirectBack();
                 }
                 if ($back_url) {
                     $this->redirect($back_url);
                 } else {
                     $this->redirectToHome();
                 }
             }
         }
         if ($this->options['auth_captcha'] && !$is_site_offline) {
             cmsUser::sessionSet('is_auth_captcha', true);
         }
         if ($is_captcha_valid) {
             cmsUser::addSessionMessage(LANG_LOGIN_ERROR, 'error');
             if ($is_site_offline) {
                 $this->redirectBack();
             }
         } else {
             cmsUser::addSessionMessage(LANG_CAPTCHA_ERROR, 'error');
         }
     }
     if ($back_url) {
         cmsUser::addSessionMessage(LANG_LOGIN_REQUIRED, 'error');
     }
     if (cmsUser::sessionGet('is_auth_captcha')) {
         $captcha_html = cmsEventsManager::hook('captcha_html');
     }
     return cmsTemplate::getInstance()->render('login', array('back_url' => $back_url, 'captcha_html' => isset($captcha_html) ? $captcha_html : false));
 }
开发者ID:asphix,项目名称:icms2,代码行数:59,代码来源:login.php

示例2: run

 public function run()
 {
     if (cmsUser::isLogged()) {
         $this->redirectToHome();
     }
     $email = $this->request->get('login_email', '');
     $password = $this->request->get('login_password', '');
     $remember = (bool) $this->request->get('remember');
     $back_url = $this->request->get('back', '');
     $is_site_offline = !cmsConfig::get('is_site_on');
     $is_submit = $this->request->has('submit');
     if ($is_submit) {
         $is_captcha_valid = true;
         if (cmsUser::sessionGet('is_auth_captcha') && $this->options['auth_captcha']) {
             $is_captcha_valid = cmsEventsManager::hook('captcha_validate', $this->request);
         }
         if ($is_captcha_valid) {
             cmsUser::sessionUnset('is_auth_captcha');
             $logged_id = cmsUser::login($email, $password, $remember);
             if ($logged_id) {
                 if ($is_site_offline) {
                     $userSession = cmsUser::sessionGet('user');
                     if (!$userSession['is_admin']) {
                         cmsUser::addSessionMessage(LANG_LOGIN_ADMIN_ONLY, 'error');
                         cmsUser::logout();
                         $this->redirectBack();
                     }
                 }
                 cmsEventsManager::hook('auth_login', $logged_id);
                 $auth_redirect = $this->options['auth_redirect'];
                 $is_first_auth = cmsUser::getUPS('first_auth', $logged_id);
                 if ($is_first_auth) {
                     $auth_redirect = $this->options['first_auth_redirect'];
                     cmsUser::deleteUPS('first_auth', $logged_id);
                 }
                 if ($back_url) {
                     $this->redirect($back_url);
                 } else {
                     $this->redirect($this->getAuthRedirectUrl($auth_redirect));
                 }
             }
         }
         if ($this->options['auth_captcha'] && !$is_site_offline) {
             cmsUser::sessionSet('is_auth_captcha', true);
         }
         if ($is_captcha_valid) {
             cmsUser::addSessionMessage(LANG_LOGIN_ERROR, 'error');
             if ($is_site_offline) {
                 $this->redirectBack();
             }
         } else {
             cmsUser::addSessionMessage(LANG_CAPTCHA_ERROR, 'error');
         }
         if ($this->options['auth_redirect'] == 'none' || !empty($is_first_auth) && $this->options['first_auth_redirect'] == 'none') {
             if (!$back_url) {
                 $back_url = $this->getBackURL();
             }
         }
     }
     if ($back_url && !$is_submit) {
         cmsUser::addSessionMessage(LANG_LOGIN_REQUIRED, 'error');
     }
     if (cmsUser::sessionGet('is_auth_captcha')) {
         $captcha_html = cmsEventsManager::hook('captcha_html');
     }
     return $this->cms_template->render('login', array('back_url' => $back_url, 'captcha_html' => isset($captcha_html) ? $captcha_html : false));
 }
开发者ID:Val-Git,项目名称:icms2,代码行数:67,代码来源:login.php


注:本文中的cmsUser::sessionUnset方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。