當前位置: 首頁>>代碼示例>>PHP>>正文


PHP zmf::delCookie方法代碼示例

本文整理匯總了PHP中zmf::delCookie方法的典型用法代碼示例。如果您正苦於以下問題:PHP zmf::delCookie方法的具體用法?PHP zmf::delCookie怎麽用?PHP zmf::delCookie使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在zmf的用法示例。


在下文中一共展示了zmf::delCookie方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: actionLogin

 function actionLogin()
 {
     $this->layout = 'common';
     if (!Yii::app()->user->isGuest) {
         $this->message(0, '您已登錄,請勿重複操作', Yii::app()->createUrl('admin/index/index'));
     }
     $model = new LoginForm();
     if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') {
         echo CActiveForm::validate($model);
         Yii::app()->end();
     }
     if (isset($_POST['LoginForm'])) {
         $model->attributes = $_POST['LoginForm'];
         if ($model->validate() && $model->login()) {
             $arr = array('latestLoginTime' => zmf::now());
             $uid = Yii::app()->user->id;
             if (!$this->checkPower('user', $uid, true)) {
                 Yii::app()->user->logout();
                 $model->addError('username', '您不是管理員');
             } else {
                 //User::model()->updateByPk($uid, $arr);
                 zmf::delCookie('checkWithCaptcha');
                 //隻允許單點登錄
                 $randKey = zmf::randMykeys(8);
                 zmf::setCookie('adminRandKey' . $uid, $randKey, 86400);
                 zmf::setFCache('adminRandKey' . $uid, $randKey, 86400);
                 //記錄操作
                 //UserLog::add($uid, '登錄後台'.Yii::app()->request->userHostAddress);
                 $uuid = zmf::uuid();
                 zmf::setCookie('userCheckedLogin' . $uid, $uuid, 86400);
                 $this->redirect(array('index/index'));
             }
         } else {
             $times = zmf::getCookie('checkWithCaptcha');
             zmf::setCookie('checkWithCaptcha', intval($times) + 1, 86400);
         }
     }
     $data = array('model' => $model);
     $this->render('login', $data);
 }
開發者ID:ph7pal,項目名稱:momo,代碼行數:40,代碼來源:SiteController.php

示例2: actionLogin

 public function actionLogin()
 {
     $this->onlyOnPc();
     $this->layout = 'common';
     if (!Yii::app()->user->isGuest) {
         $this->message(0, '您已登錄,請勿重複操作');
     }
     $canLogin = true;
     $ip = Yii::app()->request->getUserHostAddress();
     $cacheKey = 'loginErrors-' . $ip;
     $errorTimes = zmf::getFCache($cacheKey);
     if ($errorTimes >= 5) {
         $canLogin = false;
     }
     if ($canLogin) {
         $model = new FrontLogin();
         if (isset($_POST['FrontLogin'])) {
             $model->attributes = $_POST['FrontLogin'];
             if ($model->validate() && $model->login()) {
                 $arr = array('latestLoginTime' => zmf::now());
                 $uid = Yii::app()->user->id;
                 //                    User::model()->updateByPk($uid, $arr);
                 zmf::delCookie('checkWithCaptcha');
                 zmf::delFCache($cacheKey);
                 if ($this->referer) {
                     $this->redirect($this->referer);
                 } else {
                     $this->redirect(zmf::config('baseurl'));
                 }
             } else {
                 zmf::updateFCacheCounter($cacheKey, 1, 3600);
                 zmf::setCookie('checkWithCaptcha', 1, 86400);
             }
         }
     }
     $this->pageTitle = '登錄';
     $this->render('login', array('model' => $model));
 }
開發者ID:ph7pal,項目名稱:momo,代碼行數:38,代碼來源:SiteController.php

示例3: actionLogin

 public function actionLogin($from = '')
 {
     if (!Yii::app()->user->isGuest) {
         $this->message(0, '您已登錄,請勿重複操作');
     }
     $model = new LoginForm();
     //登錄
     if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') {
         echo CActiveForm::validate($model);
         Yii::app()->end();
     }
     if (isset($_POST['ajax']) && $_POST['ajax'] === 'users-addUser-form') {
         echo CActiveForm::validate($modelUser);
         Yii::app()->end();
     }
     //登錄
     if (isset($_POST['LoginForm'])) {
         $from = 'login';
         $model->attributes = $_POST['LoginForm'];
         if ($model->validate()) {
             if ($model->login()) {
                 $arr = array('last_login_ip' => ip2long(Yii::app()->request->userHostAddress), 'last_login_time' => zmf::now());
                 Users::model()->updateByPk(Yii::app()->user->id, $arr);
                 Users::model()->updateCounters(array('login_count' => 1), ':id=id', array(':id' => Yii::app()->user->id));
                 if ($this->referer == '') {
                     $this->referer = array('users/index');
                 }
                 zmf::delCookie('checkWithCaptcha');
                 $this->redirect($this->referer);
             }
         } else {
             zmf::setCookie('checkWithCaptcha', 1, 86400);
         }
     }
     $this->pageTitle = '登錄 - ' . zmf::config('sitename');
     $this->render('login', array('model' => $model));
 }
開發者ID:ph7pal,項目名稱:mei,代碼行數:37,代碼來源:SiteController.php

示例4: actionLogin


//.........這裏部分代碼省略.........
             } elseif ($bind == 'weixin') {
                 $strdata = zmf::getCookie('userWeixinData');
                 //取出cookie中用戶的微博信息
                 if (!$strdata) {
                     $model->addError('email', '未能獲取微信綁定信息,請重試');
                 } else {
                     $binddata = unserialize($strdata);
                 }
                 //根據當前用戶名獲取他是否已經綁定過
                 $email = $_POST['LoginForm']['email'];
                 $validator = new CEmailValidator();
                 if ($validator->validateValue($email)) {
                     $user = Users::model()->find('email=:email', array(':email' => $email));
                 } else {
                     $user = Users::model()->find('truename=:truename', array(':truename' => $email));
                 }
                 if ($user) {
                     $bindInfo = UserWeixin::model()->findByPk($user['id']);
                     if ($bindInfo) {
                         $hasBind = true;
                     }
                     $binddata['uid'] = $user['id'];
                 }
             }
             if ($hasBind) {
                 $model->addError('email', '該賬號已綁定其他賬號');
             } elseif ($model->login()) {
                 $arr = array('last_login_ip' => ip2long(Yii::app()->request->userHostAddress), 'last_login_time' => time());
                 Users::model()->updateByPk(Yii::app()->user->id, $arr);
                 Users::model()->updateCounters(array('login_count' => 1), ':id=id', array(':id' => Yii::app()->user->id));
                 if ($this->referer == '') {
                     $this->referer = array('users/index', 'id' => Yii::app()->user->id);
                 }
                 zmf::delCookie('checkWithCaptcha');
                 //微博綁定已有賬號
                 if ($bind == 'weibo') {
                     UserSina::addCookie($binddata);
                 } elseif ($bind == 'qq') {
                     UserQq::addCookie($binddata);
                 } elseif ($bind == 'weixin') {
                     UserWeixin::addCookie($binddata);
                 }
                 $this->redirect($this->referer);
             }
         } else {
             zmf::setCookie('checkWithCaptcha', 1, 86400);
         }
     } elseif (isset($_POST['Users'])) {
         $from = 'reg';
         //注冊
         if (UserAction::checkRegTimes()) {
             $this->message(0, '您今天的注冊次數已用完');
         }
         $email = zmf::filterInput($_POST['Users']['email'], 't', 1);
         $truename = zmf::filterInput($_POST['Users']['truename'], 't', 1);
         $inputData = array('truename' => $truename, 'password' => $_POST['Users']['password'] != '' ? md5($_POST['Users']['password']) : '', 'email' => $email, 'cTime' => time(), 'register_time' => time(), 'last_login_time' => time(), 'groupid' => zmf::config('userDefaultGroup'), 'register_ip' => ip2long(Yii::app()->request->userHostAddress), 'last_login_ip' => ip2long(Yii::app()->request->userHostAddress));
         $modelUser->attributes = $inputData;
         if ($modelUser->validate()) {
             if ($modelUser->save()) {
                 $_model = new LoginForm();
                 $_model->email = $email;
                 $_model->password = $_POST['Users']['password'];
                 $_model->login();
                 if ($bind == 'weibo') {
                     $strdata = zmf::getCookie('userWeiboData');
                     //取出cookie中用戶的微博信息
開發者ID:ph7pal,項目名稱:wedding,代碼行數:67,代碼來源:SiteController.php

示例5: actionMergecookie

 /**
  * 合並用戶關注的地區
  */
 public function actionMergecookie()
 {
     $type = tools::val('type', 't', 1);
     if (!in_array($type, array('add', 'del'))) {
         $this->jsonOutPut(0, '不允許的類型');
     }
     $uid = zmf::uid();
     switch ($type) {
         case 'add':
             $this->checkLogin();
             $cache = zmf::getCookie('myLikeAreas');
             if ($cache) {
                 //取出隻存在於cookie的地區id
                 $items = AreaLikes::model()->findAll(array('select' => 'logid', 'condition' => "uid={$uid} AND logid NOT IN({$cache})"));
                 $ids = array_keys(CHtml::listData($items, 'logid', ''));
                 if (!empty($ids)) {
                     $extraInfo = Users::getExtra($this->userInfo);
                     if ($extraInfo['likeAreas']) {
                         $arr = explode(',', $extraInfo['likeAreas']);
                     }
                     foreach ($ids as $id) {
                         $attr = array('uid' => $uid, 'logid' => $id);
                         $model = new AreaLikes();
                         $model->attributes = $attr;
                         if ($model->save()) {
                             $arr[] = $id;
                         }
                     }
                     $arr = array_unique(array_filter($arr));
                     $extraInfo['likeAreas'] = join(',', $arr);
                     Users::updateExtra($uid, $extraInfo);
                 }
             }
             zmf::delCookie('myLikeAreas');
             $this->jsonOutPut(1, '合並成功');
             break;
         case 'del':
             zmf::delCookie('myLikeAreas');
             $this->jsonOutPut(1, '刪除成功');
             break;
     }
 }
開發者ID:ph7pal,項目名稱:wedding,代碼行數:45,代碼來源:AjaxController.php


注:本文中的zmf::delCookie方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。