无法访问codeigniter的仪表板

时间:2014-04-01 05:53:47

标签: php codeigniter

目前我正在使用codeigniter框架。我无法访问该应用程序的管理面板。当我登录仪表板时,它将重定向到未知页面(404错误)。这是我的登录控制器代码段。任何人请帮助我,并提前感谢。

 class Auth extends MY_Controller {

    function __construct()
    {
        parent::__construct();

      session_start();

        $this->load->helper(array('url', 'cookie'));

        $this->load->helper(array('form', 'form_tracker'));

        $this->load->library('session');

        $this->load->library('adminauth');
    }

    function index()
    {
        $this->login();
    }

    function logout()
    {     
    $this->adminauth->logout();

    $data['core_view'] = 'admin/login/logout_confirm';

    $this->_show_page($data);
  }

    function login()
    {         

       $data['admin_timeout'] = $this->adminauth->get_admin_timeout();

        $this->load->library('validation');

      $rules['email'] = "required|callback__try_login";

      $this->validation->set_rules($rules);

      $fields['email'] = 'Email Address';

      $this->validation->set_fields($fields);

      $this->validation->set_message('required', "Invalid email address and / or password. Passwords are case sensitive. Please try again.");

        if (!$this->adminauth->logged_in()) {
          $data['html_redirect_to'] = $this->input->get('rd');    
        $data['core_view'] = 'admin/login/login';

        $this->_show_page($data);
      } else {
        if ($this->adminauth->logged_in()) {
          //TODO: handle redirections here
          $redirect_to = $this->input->get('rd');
          if (empty($redirect_to)) {$redirect_to = '/admin';}
          redirect($redirect_to);
        } else {
          $this->_error_page(array("error_string" => 'An error occured while attempting to log you in. Please contact support.'));
        }
      }

  }

  function _try_login($email)
    {
        if ($this->adminauth->login($email, $this->input->post('password')))
        {
            return true;
        }
        else
        {
            $this->validation->set_message('_try_login', 'Invalid email address and / or password. Passwords are case sensitive. Please try again.');
            return false;
        }
    }

    function _show_page($data)
    {
    array_walk_recursive($data, 'smart_quote');

    $this->load->view('admin/navigation/header', $data);
    $this->load->view($data['core_view'], $data);
    $this->load->view('admin/navigation/footer', $data);
  }

  function _error_page($data = array())
  { 
      // get universal data and merge with passed data
      $data = array_merge($this->data, $data);

    $data['core_view'] = 'admin/templates/inner_error';

    $this->_show_page($data);

        echo $this->output->get_output();
        exit();
  }
}

0 个答案:

没有答案