Exemplo n.º 1
0
 /**
  * Displays event view page.
  *
  * @return mixed
  */
 public function actionShow()
 {
     if (Yii::$app->request->get("eventname") == "") {
         throw new CHttpException(404, 'The specified post cannot be found.');
     }
     $eventname = Yii::$app->request->get("eventname");
     $list = Events::find()->where(['link' => $eventname]);
     if ($list->count() == 0) {
         throw new CHttpException(404, 'The specified post cannot be found.');
     }
     $list = $list->one();
     $org = Users::find()->where(['id' => $list["FK_organizer_id"]])->one();
     $participients = UsersEvents::find()->where(['FK_event_id' => $list->id]);
     $pars = array();
     if ($participients->count() == 0) {
         $participients = false;
     }
     if ($participients) {
         $participients = $participients->all();
         foreach ($participients as $value) {
             $pars[] = $value["id"];
         }
     }
     Users::current()->id;
     $participients = Users::find()->where(['id' => $pars])->all();
     return $this->render('view', ['model' => $list, 'org' => $org, 'participients' => $participients]);
 }
 public function actionIndex()
 {
     $result = Yii::$app->request;
     if ($result->post('event') === 'Login_Event') {
         $login = $result->post('login');
         $password = $result->post('password');
         $user = Users::find()->from('users')->where(['email' => $login, 'password' => $password])->one();
         if (!empty($user)) {
             $ip = Yii::$app->request->getUserIP();
             $id = $user->person_id;
             $sessionId = Helper::generateRandomString(date("Y_m_d_H_i_s"), 15);
             $session = Yii::$app->session;
             $session->setId('' . $sessionId);
             $session->set("login", $login);
             $session->set("IP", $ip);
             $session->set("success", "accept");
             $session->set("id", $id);
             $user->session_id = $sessionId;
             $user->save();
             $answer = 'success';
         } else {
             $answer = 'denied';
         }
         Yii::$app->response->format = \yii\web\Response::FORMAT_JSON;
         if ($answer == 'success') {
             return array('event' => 'Login_Event', 'answer' => $answer, 'url' => Yii::$app->urlManager->createUrl(['network/index', 'id' => $id]));
         }
         return array('event' => 'Login_Event', 'answer' => $answer);
     } else {
         return $this->render('index', array());
     }
 }
Exemplo n.º 3
0
 public function actionIndex()
 {
     $query = Users::find()->leftJoin('media', array('id' => 'user_id'))->where(['type' => 1, 'active' => 1]);
     $countQuery = clone $query;
     $pages = new Pagination(['totalCount' => $countQuery->count()]);
     echo $pages;
     die;
     $page = 1;
     if (isset($_REQUEST["page"])) {
         $page = intVal($_REQUEST["page"]);
     }
     $limit = 12;
     $offset = $limit * ($page - 1);
     $pageSize = ceil($countQuery->count() / $limit);
     $pages->setPageSize($pageSize);
     $models = $query->offset($offset)->limit($limit)->all();
     $city = City::find()->all();
     return $this->render('index', ['models' => $models, 'pages' => $pages, 'city' => $city]);
 }
Exemplo n.º 4
0
 public function actionGetpass()
 {
     $model = new Users();
     $pass = $model->find()->select(['FIELD4'])->where(['FIELD3' => 'telkom'])->scalar();
     echo $this->decrypt($pass);
 }
 public function actionIndex()
 {
     $data = Users::find()->asArray()->all();
     return $this->render('index', ['data' => $data]);
 }