Default.class.php 949 Bytes
<?php
/**
 * 默认控制器
 */
class Controller_Admin_Default extends Controller_Admin_Base 
{
    
    /**
     * 登录
     */
    public function indexAction()
    {
        //是否登录错误
        $error = false ;
        $this->_admin = false;
        if ($this->_request->isPost())
        {
            if ( $this->login($this->_request->username , $this->_request->password))
            {
                return $this->_redirect(url('news/index'));
            }
            $error = true;
        }
        if ($this->_admin)
        {
            return $this->_redirect(url('news/index'));
        }
        $this->_view['error'] = $error ;
        $this->_view['account'] = array('username' => $this->_request->query('username',''), 'password' =>  $this->_request->query('password',''));
    }
    
    public function logoutAction()
    {
        $this->logout() ;
        return $this->_redirect(url('default/index'));
    }
}