Exemple #1
0
 protected function OnInput()
 {
     $mUsers = M_Users::Instance();
     parent::onInput();
     $this->mysql->Connect('localhost', 'root', '', 'liveblog');
     $this->title = $this->title . ' :: Чтение';
     if ($this->IsPost()) {
         if ($mUsers->Login($_POST['login'], $_POST['password'])) {
             header('Location: index.php?c=index');
             die;
         }
     }
     if (empty($_GET['id'])) {
         $this->articles = $this->mysql->Select('SELECT * FROM articles ORDER BY add_time DESC');
         $this->articles = $this->m_articles->cut_contents($this->articles);
         $this->back = 0;
     } else {
         if ($_GET['id'] === 'logout') {
             $mUsers->Logout();
             header('Location: index.php');
             exit;
         }
         $this->articles = $this->m_articles->show_one_article_index($_GET['id']);
         $this->back = '1';
         $this->last_edit = '1';
     }
     //  $vars = array('title' => $this->title, 'content' => $this->content);
     //  $page = $this->Template('views/v_main.php', $vars);
     //  echo $page;
 }