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


PHP Admin::model方法代码示例

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


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

示例1: actionLogin

 public function actionLogin()
 {
     $this->layout = "login_layout";
     $request = Yii::app()->request;
     if ($request->isPostRequest && isset($_POST)) {
         try {
             $admin_name = Yii::app()->request->getPost('admin_name');
             $admin_password = Yii::app()->request->getPost('admin_password');
             $user = Admin::model()->findByAttributes(array('admin_name' => $admin_name));
             if ($user) {
                 //user existed, check password
                 if ($user->admin_password == md5($admin_password)) {
                     Yii::app()->session['admin_id'] = $user->admin_id;
                     $this->redirect($this->md('home/user'));
                 } else {
                     //wrong device token
                     //                        echo "đm lỗi2";
                     //                        die();
                     $this->redirect('login');
                 }
                 // }
             } else {
                 //user not existed
                 //                    echo "đm lỗi3";
                 //                    die();
                 $this->redirect('login');
             }
         } catch (exception $e) {
             echo $e->getMessage();
         }
     }
     $this->render('login/index');
 }
开发者ID:huynt57,项目名称:bluebee-uet.com,代码行数:33,代码来源:HomeController.php

示例2: run

 public function run($args)
 {
     $user_info = Admin::model()->findAll();
     $count = Advice::model()->count('status=0');
     foreach ($user_info as $row) {
         if ($row->send_email == 0 || empty($row->email)) {
             continue;
         }
         $message = "您今天新增" . $count . "条后勤办反馈建议\n\t        \t\t'http://localhost/logistics/index.php?r=admin/index/index' 点击链接登录后台进行查看";
         $mailer = Yii::createComponent('application.extensions.mailer.EMailer');
         $mailer->Host = 'smtp.qq.com';
         $mailer->IsSMTP();
         $mailer->SMTPAuth = true;
         $mailer->From = '472406004@qq.com';
         $mailer->AddReplyTo("{$row->email}");
         $mailer->AddAddress("{$row->email}");
         $mailer->FromName = '你大爷';
         $mailer->Username = '472406004';
         //这里输入发件地址的用户名
         $mailer->Password = '199401045216hyf';
         //这里输入发件地址的密码
         $mailer->SMTPDebug = true;
         //设置SMTPDebug为true,就可以打开Debug功能,根据提示去修改配置
         $mailer->CharSet = 'UTF-8';
         $mailer->Subject = Yii::t('demo', 'Yii rulez!');
         $mailer->Body = $message;
         $x = $mailer->Send();
         $x = $mailer->Send();
     }
 }
开发者ID:houyf,项目名称:class_system,代码行数:30,代码来源:TestCommand.php

示例3: authenticate

 /**
  * Authenticates user dengan menggunakan user model (Admin.php)
  */
 public function authenticate()
 {
     /* find data dengan atribut username
      * menggunakan model Admin */
     $user = Admin::model()->findByAttributes(array('username' => $this->username));
     /* jika user hasilnya null maka
      * kasih error invalid username */
     if ($user === null) {
         $this->errorCode = self::ERROR_USERNAME_INVALID;
         /* jika tidak null */
     } else {
         /* cek jika password yang ada didalam database
          * tidak sama dengan password yang dienkrip maka
          * kasih error password invalid */
         if ($user->password !== $user->encrypt($this->password)) {
             $this->errorCode = self::ERROR_PASSWORD_INVALID;
             /* jika sama password_database==password_enkrip */
         } else {
             /* jika password yang dienkrip sama dengan
              * yang ada di dalam database maka */
             /* ambil data user id dan
              * ditampung oleh variable _id */
             $this->_id = $user->admin_id;
             /* set state username agar dapat ditampilkan
              * sebagai data user yang login
              */
             $this->setState('username', $user->username);
             $this->setState('adminLogin', TRUE);
             /* kasih error none pada variable errorCode */
             $this->errorCode = self::ERROR_NONE;
         }
     }
     /* kembalikan bukan error code */
     return !$this->errorCode;
 }
开发者ID:budisyaa,项目名称:SIPP,代码行数:38,代码来源:AdminLogin.php

示例4: actionAddBlog

 public function actionAddBlog()
 {
     $model = new Post();
     $rec = Lookup::model()->findAll(array('condition' => 'type=:t', 'params' => array(':t' => 'PostStatus')));
     $admin = Admin::model()->find();
     $adminId = $admin->id;
     foreach ($rec as $type) {
         $id[] = $type->id;
         $name[] = $type->name;
         $op = array_combine($id, $name);
     }
     if (isset($_POST['Post'])) {
         $model->attributes = $_POST['Post'];
         if ($model->validate()) {
             $model->author_id = $adminId;
             if ($model->save()) {
                 $this->redirect(array('postlisting', 'id' => $model->id));
             }
         } else {
             $errors = $model->getErrors();
             //var_dump($errors);
         }
     }
     $this->render('addblog', array('model' => $model, 'type' => $op));
 }
开发者ID:KaranSofat,项目名称:yii,代码行数:25,代码来源:PostController.php

示例5: it_allows_manually_create_model_configuration

 /** @test */
 public function it_allows_manually_create_model_configuration()
 {
     $model = new ModelConfiguration('My\\Model');
     Admin::instance()->setModel('My\\Model', $model);
     $model = Admin::model('My\\Model');
     $this->assertInstanceOf('SleepingOwl\\Admin\\Model\\ModelConfiguration', $model);
 }
开发者ID:DimaPikash,项目名称:eshop,代码行数:8,代码来源:AdminTest.php

示例6: authenticate

 public function authenticate()
 {
     /*
     $users=array(
     	// username => password
     	'demo'=>'demo',
     	'admin'=>'admin',
     );
     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;
     */
     $username = strtolower($this->username);
     $user = Admin::model()->find('LOWER(username)=?', array($username));
     if ($user === null) {
         $this->errorCode = self::ERROR_USERNAME_INVALID;
     } else {
         if ($user->PASSWORD != $this->password) {
             $this->errorCode = self::ERROR_PASSWORD_INVALID;
         } else {
             // successful login
             $this->_id = $user->ID_ADMIN;
             $this->username = $user->USERNAME;
             //$this->setState('level', $user->level);
             //untuk memanggil level di database menggunakan EWebUser.php nanti
             $this->errorCode = self::ERROR_NONE;
         }
     }
     return $this->errorCode == self::ERROR_NONE;
 }
开发者ID:aunorafiq,项目名称:jks,代码行数:34,代码来源:UserIdentity.php

示例7: login

 /**
  * admin login, dengan meng-input email dan password
  */
 public function login()
 {
     /*jika _indentity null maka*/
     if ($this->_identity === null) {
         /*panggil component CustomerLogin dengan param
          *email, dan password
          *dan ditampung oleh variabel _identity
          */
         $this->_identity = new CustomerLogin($this->customer_email, $this->customer_password);
         /*panggil fungsi authenticate()
          *yang ada di component CustomerLogin
          *yang akan memvalidasi email dan password*/
         $this->_identity->authenticate();
     }
     /*jika errorCode/error email dan password benar maka*/
     if ($this->_identity->errorCode === CustomerLogin::ERROR_NONE) {
         //membuat remember me durasi 30 hari
         $duration = $this->rememberMe ? 3600 * 24 * 30 : 0;
         // 30 days
         Yii::app()->user->login($this->_identity, $duration);
         //update last_login_time admin
         Admin::model()->updateByPk($this->_identity->id, array('last_login_time' => new CDbExpression('NOW()')));
         return true;
     } else {
         return false;
     }
 }
开发者ID:tierous,项目名称:yico-commerce,代码行数:30,代码来源:CustomerLoginForm.php

示例8: actionLogin

 public function actionLogin()
 {
     ob_start();
     Yii::app()->theme = 'back';
     $model = new LoginForm();
     //echo "Mohit";die;
     // 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'];
         $uName = $_POST['LoginForm']['username'];
         $uPass = $_POST['LoginForm']['password'];
         $pass = md5($uPass);
         $admin = Admin::model()->findByAttributes(array('username' => $uName, 'password' => $pass));
         $count = count($admin);
         //echo $count;die;
         // validate user input and redirect to the previous page if valid
         if ($model->validate() && $model->login()) {
             //$this->redirect(Yii::app()->user->returnUrl);
             Yii::app()->session['username'] = $uName;
         }
         if ($count > 0) {
             //Yii::app()->session['username']=$uName;
             $this->redirect('dashboard', array('model' => $model));
         } else {
             $this->render('index', array('model' => $model));
         }
     }
     // display the login form
     //$this->render('index',array('model'=>$model));
 }
开发者ID:KaranSofat,项目名称:yii,代码行数:35,代码来源:AdminController.php

示例9: actionIndex

 /**
  * 首页
  */
 public function actionIndex()
 {
     Tool::p('xx');
     $result = Admin::model()->findByPk(1);
     Tool::p($result);
     $this->render('login');
 }
开发者ID:njz817,项目名称:ycms,代码行数:10,代码来源:SiteController.php

示例10: loadModel

	private function loadModel($id)
	{
		$model=Admin::model()->findByPk($id);
		if($model===null)
			throw new CHttpException(404,'The requested page does not exist.');
		return $model;
	}
开发者ID:noikiy,项目名称:letstravel,代码行数:7,代码来源:AdminsController----.php

示例11: 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()
	{	
		$admins = Admin::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;
		
		// $_SESSION['adminInfo']=array(
		     // 'id'=>$admins->id,
			 // 'rid'=>$admins->rid,
		     // 'name'=>$admins->name,
		     // 'purview'=>explode(';',$admins->purview)
		// );
		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; */
	}
开发者ID:noikiy,项目名称:letstravel,代码行数:38,代码来源:UserIdentity.php

示例12: actionUpdateNotebook

 /**
  * 更新备忘
  *
  */
 public function actionUpdateNotebook()
 {
     $notebook = $this->_gets->getParam('notebook');
     $model = Admin::model()->findByPk($this->_admini['userId']);
     $model->notebook = trim($notebook);
     if ($model->save()) {
         exit('更新完成');
     } else {
         exit('更新失败');
     }
 }
开发者ID:tecshuttle,项目名称:51qsk,代码行数:15,代码来源:ConfigController.php

示例13: 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()
 {
     $user_info = Admin::model()->find('username = :username', array(':username' => $this->username));
     if (!isset($user_info->password)) {
         return $this->errorCode = self::ERROR_USERNAME_INVALID;
     }
     if ($user_info->password != $this->password) {
         return $this->errorCode = self::ERROR_PASSWORD_INVALID;
     }
     return !($this->errorCode = self::ERROR_NONE);
 }
开发者ID:houyf,项目名称:class_system,代码行数:19,代码来源:UserIdentity.php

示例14: authenticate

 public function authenticate()
 {
     $user = Admin::model()->find("LOWER(username)=? and password=? and status=1", array(strtolower($this->username), md5($this->password)));
     if ($user === null) {
         return false;
     } else {
         $this->_id = $user->id;
         $this->setState('userInfo', $user);
         $this->errorCode = UserIdentity::ERROR_NONE;
         return true;
     }
 }
开发者ID:jvlstudio,项目名称:ask,代码行数:12,代码来源:UserIdentity.php

示例15: 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()
 {
     $users = Admin::model()->findByAttributes(array('name' => $this->username));
     if ($users == null) {
         $this->errorCode = self::ERROR_USERNAME_INVALID;
     } elseif ($users->password != md5($this->password)) {
         $this->errorCode = self::ERROR_PASSWORD_INVALID;
     } else {
         Yii::app()->user->name = $users->name;
         $this->errorCode = self::ERROR_NONE;
     }
     return !$this->errorCode;
 }
开发者ID:renlong567,项目名称:YiiYurenGithub,代码行数:21,代码来源:UserIdentity.php


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