本文整理汇总了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));
}
示例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);
}