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


PHP UserAction::checkRegTimes方法代碼示例

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


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

示例1: actionLogin


//.........這裏部分代碼省略.........
                 }
                 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中用戶的微博信息
                     if ($strdata) {
                         $binddata = unserialize($strdata);
                         $binddata['uid'] = Yii::app()->user->id;
                         UserSina::addCookie($binddata);
                     }
                 } elseif ($bind == 'qq') {
                     $strdata = zmf::getCookie('userQQData');
                     //取出cookie中用戶的微博信息
                     if ($strdata) {
                         $binddata = unserialize($strdata);
                         $binddata['uid'] = Yii::app()->user->id;
                         UserQq::addCookie($binddata);
                     }
                 } elseif ($bind == 'weixin') {
                     $strdata = zmf::getCookie('userWeixinData');
                     //取出cookie中用戶的微信信息
                     if ($strdata) {
                         $binddata = unserialize($strdata);
                         $binddata['uid'] = Yii::app()->user->id;
                         UserWeixin::addCookie($binddata);
                     }
                 }
                 //登錄成功後跳轉到修改個人資料頁麵
                 $this->redirect(array('users/update', 'type' => 'info'));
             }
         }
     }
     if ($bind) {
         $this->loginTitle = '綁定已有賬戶';
         $this->regTitle = '完善資料';
     } else {
         $this->loginTitle = '登錄';
         $this->regTitle = '注冊';
     }
     if ($from == 'login') {
         $this->pageTitle = $this->loginTitle . ' - ' . zmf::config('sitename');
     } else {
         $this->pageTitle = $this->regTitle . ' - ' . zmf::config('sitename');
     }
     //登錄頁麵的幻燈片
     $flashArr = Ads::getAllByPo('twindex', 'flash', '', 5);
     if (!empty($flashArr)) {
         foreach ($flashArr as $k => $val) {
             $_imgurl = zmf::uploadDirs($val['cTime'], 'site', $val['classify'], 600) . $val['filePath'];
             $flashArr[$k]['imgurl'] = $_imgurl;
         }
     }
     $this->render('login', array('model' => $model, 'modelUser' => $modelUser, 'from' => $from, 'flashs' => $flashArr));
 }
開發者ID:ph7pal,項目名稱:wedding,代碼行數:101,代碼來源:SiteController.php

示例2: actionReg

 public function actionReg()
 {
     if (!Yii::app()->user->isGuest) {
         $this->message(0, '您已登錄,請勿重複操作');
     }
     $model = new Users();
     if (isset($_POST['ajax']) && $_POST['ajax'] === 'users-addUser-form') {
         echo CActiveForm::validate($model);
         Yii::app()->end();
     }
     if (isset($_POST['Users'])) {
         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);
         $model->attributes = $inputData;
         if ($model->validate()) {
             if ($model->save()) {
                 $_model = new LoginForm();
                 $_model->email = $email;
                 $_model->password = $_POST['Users']['password'];
                 $_model->login();
                 $this->referer = array('users/index', 'id' => Yii::app()->user->id);
                 $this->redirect($this->referer);
             }
         }
     }
     $data = array('model' => $model);
     $this->pageTitle = '免費注冊 - ' . zmf::config('sitename');
     $this->render('addUser', $data);
 }
開發者ID:ph7pal,項目名稱:naodong,代碼行數:33,代碼來源:SiteController.php


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