2015-11-20 78 views
1

我有这应该重定向到另一页上的成功有以下功能:笨内部服务器错误到另一个页面

public function process() { 


     $username = $this->input->post('username'); 
     $password = $this->input->post('password'); 
     // Validate the user can login 

     $result = $this->login_model->validate($username, $password); 
     // Now we verify the result 
     if (!$result) { 

      if (empty($password)) { 
       $msg = '<font color=red>Invalid username and/or password.</font><br />'; 
       $this->index($msg); 
      } else { 

       $msg = '<font color=red>Invalid username and/or password.</font><br />'; 
       $this->index($msg); 
      } 
     } else { 
      // If user did validate, 
      // Send them to members area 
      redirect('home'); 
     } 
    } 

如果它是有效的,那么我应该被重定向到回家,但不幸的是我出现以下错误:

HTTP ERROR: 500 

Internal Server Error 

RequestURI=http://system.uniqueloo.co.ke/login/process 

有另一种方法可以让我做笨重定向不使用PHP的重定向功能?

+0

你检查htaccess文件? –

回答

0

确保指数函数接受传入参数

在控制器

public function process() { 

    $username = $this->input->post('username'); 
    $password = $this->input->post('password'); 

    $result = $this->login_model->validate($username, $password); 

    if (isset($result)) { #change this 

     if (empty($password)) { 

      $msg = '<font color=red>Invalid username and/or password.</font><br />'; 
      $this->index($msg); # not sure about this 
     } 
     else { 

      $msg = '<font color=red>Invalid username and/or password.</font><br />'; 
      $this->index($msg); # not sure about this 
     } 
    } 
    else { 

     redirect('home'); 
    } 
}