本文整理汇总了PHP中Member::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Member::model方法的具体用法?PHP Member::model怎么用?PHP Member::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Member
的用法示例。
在下文中一共展示了Member::model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: run
public function run()
{
parent::run();
$data['user']['total'] = Member::model()->count();
$data['user']['new'] = Member::model()->find(array("order" => "id desc"));
$this->render('statistics', $data);
}
示例2: actionEmail
public function actionEmail()
{
if (empty(Yii::app()->session['ValidateMid'])) {
throw new CHttpException(400, '链接已失效!');
exit;
}
if ($_GET['mid'] == Yii::app()->session['ValidateMid'] && base64_decode($_GET['key']) > time()) {
/*if(empty($_GET['mid'])){
header("Content-Type: text/html; charset=utf-8");
echo "<script>alert('没有此用户!');</script>";
exit;
}*/
$returnValue = Member::model()->updateAll(array('email_validate' => 1), "id=" . Yii::app()->session['ValidateMid']);
if ($returnValue > 0) {
unset(Yii::app()->session['ValidateMid']);
$this->redirect(array('member/email'));
} else {
echo "shibai";
}
} else {
if ($_GET['mid'] != Yii::app()->session['mid']) {
header("Content-Type: text/html; charset=utf-8");
echo "<script>alert('用户名不匹配!');</script>";
exit;
}
if (base64_decode($_GET['key']) < time()) {
header("Content-Type: text/html; charset=utf-8");
echo "<script>alert('时间超时请重新申请!');</script>";
exit;
}
}
}
示例3: actionLogin
public function actionLogin()
{
if (!Yii::app()->user->isGuest) {
$this->redirect(array('site/index'));
}
$model = new LoginForm();
// if it is ajax validation request
if (isset($_POST['ajax']) && $_POST['ajax'] === 'login-form') {
echo CActiveForm::validate($model);
Yii::app()->end();
}
// collect user input data
if (isset($_POST['LoginForm'])) {
$model->attributes = $_POST['LoginForm'];
if ($model->validate() && $model->login()) {
$this->redirect(Yii::app()->request->urlReferrer);
} else {
$returnName = Member::model()->findByAttributes(array('mname' => trim($_POST['LoginForm']['username'])));
if (empty($returnName)) {
echo 'namenull';
} elseif ($returnName->password != Member::model()->encrypt($_POST['LoginForm']['password'])) {
echo 'passworderror';
} else {
echo 'verifyCodeerror';
}
}
}
// display the login form
$this->render('login', array('model' => $model));
}
示例4: actionIndex
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionIndex()
{
$model = new Order();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (empty(Yii::app()->user->id)) {
throw new CHttpException(400, '您目前还没有登录请登录!');
exit;
}
$email = Member::model()->findByAttributes(array('id' => Yii::app()->user->id));
if (empty($email->email)) {
throw new CHttpException(400, '您的个人资料里邮箱没有填写!');
exit;
}
if ($email->email_validate == 0) {
throw new CHttpException(400, '您的个人资料里邮箱没有验证!');
//header("Location: ../member/update/".Yii::app()->user->id.".html");
}
if (isset($_POST['Order'])) {
$model->attributes = $_POST['Order'];
if ($model->save()) {
$this->redirect(array('view', 'id' => $model->id));
}
}
$this->render('create', array('model' => $model));
}
示例5: authenticate
public function authenticate($isopenid = false, $memberid = null, $key = null)
{
if ($isopenid) {
$this->_id = $memberid;
return true;
}
$member = Member::model()->getMember($this->username);
if ($member === null) {
$this->errorCode = self::ERROR_USERNAME_INVALID;
} else {
// activate the member if key matches the invite key
// if(!empty($key) && $key === $member->invitekey)
// {$member->active = 1;$member->save(false);}
if ($member["password"] !== Member::model()->encrypt($this->password)) {
$this->errorCode = self::ERROR_PASSWORD_INVALID;
} else {
if ($member["active"] == 0) {
$this->errorCode = self::ERROR_MEMBER_INACTIVE;
} else {
$this->_id = $member["memberid"];
if (null === $member["lastlogintime"]) {
$lastLogin = time();
} else {
$lastLogin = strtotime($member["lastlogintime"]);
}
$this->setState('lastLoginTime', $lastLogin);
$this->setState('membername', $member["membername"]);
$this->errorCode = self::ERROR_NONE;
}
}
}
return !$this->errorCode;
}
示例6: actionSave
public function actionSave()
{
if ($_POST) {
$trans = Yii::app()->db->beginTransaction();
try {
$id_member = $_POST['id_member'];
$new_id_member = $_POST['new_id_member'];
$member = Member::model()->findByPk($id_member);
$member->id_member = $new_id_member;
$member->type_card = 'Diamond';
if ($member->validate() && $member->update()) {
$upgrade = new UpgradeMembership();
$upgrade->old_idmember = $_POST['id_member'];
$upgrade->new_idmember = $_POST['new_id_member'];
$upgrade->username = Yii::app()->user->getId();
$upgrade->upgrade_date = date('Y-m-d');
$upgrade->old_point = $member->point;
if ($upgrade->validate() && $upgrade->save()) {
$trans->commit();
echo CJSON::encode(array('message' => 'Membership has been upgrade successfully to Diamond'));
} else {
throw new Exception('Rollback on Upgrade Table');
}
} else {
throw new Exception('Rollback on Member Table');
}
} catch (CDbException $e) {
$trans->rollback();
}
}
}
示例7: authenticate
/**
* Authenticates a user.
* The example implementation makes sure if the username and password
* are both 'demo'.
* In practical applications, this should be changed to authenticate
* against some persistent user identity storage (e.g. database).
* @return boolean whether authentication succeeds.
*/
public function authenticate()
{
//$valid = preg_match('/^[A-Za-z0-9._%+-]+@[A-Za-z0-9.-]+\.[A-Za-z]{2,4}$/',$this->username);//验证是否为邮箱
$admins = Member::model()->find(array('condition'=>"name='$this->username' or email='$this->username'"));
//$admins = Member::model()->find('name=:name',array(':name'=>$this->username));//获取这个用户名下的信息
if($admins == NULL){
$this->errorCode=self::ERROR_USERNAME_INVALID;
return false;
}
if($admins->password !== md5($this->password)){
$this->errorCode=self::ERROR_PASSWORD_INVALID;
return false;
}
$this->errorCode=self::ERROR_NONE;
return true;
/* if(!isset($users[$this->username]))
$this->errorCode=self::ERROR_USERNAME_INVALID;
elseif($users[$this->username]!==$this->password)
$this->errorCode=self::ERROR_PASSWORD_INVALID;
else
$this->errorCode=self::ERROR_NONE;
return !$this->errorCode; */
}
示例8: authenticate
public function authenticate()
{
$this->username = trim($this->username);
$user = Member::model()->findByAttributes(array('mname' => $this->username));
if ($user === null) {
$this->errorCode = self::ERROR_USERNAME_INVALID;
} else {
if ($user->password !== $user->encrypt($this->password)) {
$this->errorCode = self::ERROR_PASSWORD_INVALID;
} else {
//if($this->createAction('captcha')->getVerifyCode()!=$this->verifyCode){
//$this->errorCode=self::ERROR_VERIFYCODE_INVALID;
//}else{
$this->_id = $user->id;
if (null === $user->login_time) {
$lastLogin = time();
} else {
$lastLogin = strtotime($user->login_time);
}
$this->_name = $user->mname;
$this->setState('lastLoginTime', $lastLogin);
$this->errorCode = self::ERROR_NONE;
//}
}
}
return !$this->errorCode;
}
示例9: get_vip
public static function get_vip($id)
{
$user = Member::model()->findByPk($id);
if (!is_array($user)) {
return 0;
}
return $user->premium == '' ? 0 : $user->premium;
}
示例10: run
public function run()
{
parent::run();
$data['mem_nhiettinh'] = Member::model()->findAll(array("limit" => 6, "order" => "point desc"));
$data['mem_chuyencan'] = Member::model()->findAll(array("limit" => 6, "order" => "diligent_point desc"));
$data['mem_thanhtich'] = Member::model()->findAll(array("limit" => 6, "order" => "mark desc"));
$this->render('top_member', $data);
}
示例11: actionSearchMember
/**
* Fifth sequence
* Method mencari data member berdasarkan id member
*/
public function actionSearchMember()
{
$id_member = $_POST['id_member'];
$criteria = new CDbCriteria();
$criteria->condition = 'id_member=:id_member';
$criteria->params = array(':id_member' => $id_member);
$model = Member::model()->find($criteria);
echo CJSON::encode($model);
}
示例12: MemberTipe
protected function MemberTipe()
{
$user = $this->loadModel();
$user = $user->username;
if ($user) {
$tipe = Member::model()->find("email = '{$user}' ")->type_account;
return $tipe;
} else {
return "Guest";
}
}
示例13: run
public function run()
{
parent::run();
$user = array();
if ($this->_session['isLogin'] == 1 & $this->_session['login_id'] > 0) {
$user = Member::model()->findByPk($this->_session['login_id']);
}
//$this->_session['login_id']
$user_login = new UserLoginForm();
$this->render('login', array('iUser' => $user_login, 'user' => $user));
}
示例14: submit
public function submit()
{
if ($this->hasErrors()) {
return false;
} else {
$member = Member::model()->findByPk($this->member_id);
if (empty($member)) {
$this->addError('member_id', '会员不存在');
return false;
}
$member->password = md5($this->new_password);
return $member->save(true, array('password'));
}
}
示例15: actionIndex
public function actionIndex()
{
//如果已经登录直接跳到账号中心的密码修改界面
if(!Yii::app()->user->isGuest){
$this->redirect('/account.html?r=pwd');
exit;
}
$model = new Forget;
if(isset($_POST['Forget']))
{
$_POST['Forget']['username'] = htmlspecialchars($_POST['Forget']['username'],ENT_QUOTES);
$model->attributes = $_POST['Forget'];
/* $model->username = $_POST['Forget']['username'];
$model->email = $_POST['Forget']['email']; */
if($model->validate()){
$name = $_POST['Forget']['username'];
$email = $_POST['Forget']['email'];
$record = Member::model()->find(array(
'condition'=>"name='".$name."'and email='".$email."'",
));
if($record){
//产生新密码
$newpwd = $this->randCode(8);
$record->password = md5($newpwd);
if($record->save(false)){
//发送邮件
$httphost = $_SERVER['HTTP_HOST'];
$message = "<div><b>亲爱的,$name</b><div>你的密码被重置为:<b>$newpwd</b> ,请点击网址(<a href='$httphost'>$httphost</a>)去重新登录并修改密码</div><div>如果以上的网址不能点击进入,请复制该网址到浏览器地址栏中</div></div>";
$subject = '莱斯旅游--密码找回';
if($this->sendEmail($email,$name,$message,$subject,$attach= '')){
$model->unsetAttributes();
Yii::app()->user->setFlash('success', "成功,<b>请查收邮件</b>");
}else{
Yii::app()->user->setFlash('error', "没有成功,请重试!");
}
}
}else{
Yii::app()->user->setFlash('error', "用户名或邮箱没有注册过!");
}
}else{
Yii::app()->user->setFlash('error', "用户名或邮箱不合法!");
}
}
$this->render('index',array(
'model'=>$model,
));
}