Exemple #1
0
 public function actionIndex()
 {
     $model = new DengluForm();
     if ($model->load(Yii::$app->request->post()) && $model->validate()) {
         $data = $_POST['DengluForm'];
         //print_r($data);die;
         $arr = Username::find()->where(['username' => $data['username']])->one();
         if ($arr) {
             if ($data['password'] == $arr['password']) {
                 $session = Yii::$app->session;
                 $session['user'] = ['id' => $arr['id'], 'username' => $arr['username']];
                 return $this->render('index');
             } else {
                 $aa['error'] = 1;
                 $aa['type'] = "<font color='red'>密码错误</font> 登录";
                 return $this->render('success', array('data' => $aa));
             }
         } else {
             $aa['error'] = 1;
             $aa['type'] = "<font color='red'>没有此用户</font> 登录";
             return $this->render('success', array('data' => $aa));
         }
     } else {
         return $this->render('login', ['model' => $model]);
     }
 }
Exemple #2
0
$form = ActiveForm::begin();
?>
		
		<b>Nama User : </b>
		<?php 
if ($model2->total_user != 0) {
    $sql = "SELECT * from username where id_user not in ({$join}) order by username ASC";
    ?>
			<?php 
    echo Html::activeDropDownList($model, 'id_user', ArrayHelper::map(Username::findBySql($sql)->all(), 'id_user', 'username'));
    ?>
		<?php 
} else {
    ?>
				<?php 
    echo Html::activeDropDownList($model, 'id_user', ArrayHelper::map(Username::find()->all(), 'id_user', 'username'));
    ?>
		<?php 
}
?>
		
		<p style='margin-bottom:5px'>&nbsp;</p>
		
		<div style='display:none'><?php 
echo $form->field($model, 'id_bagi_tugas')->textInput(['value' => $model5->max_id]);
?>
</div>
		<?php 
echo $form->field($model, 'pembagian_tugas')->textInput();
?>
	
 /**
  * Lists all Username models.
  * @return mixed
  */
 public function actionIndex()
 {
     $dataProvider = new ActiveDataProvider(['query' => Username::find()]);
     return $this->render('index', ['dataProvider' => $dataProvider]);
 }