title: Login system not working cant find verifylogin.php - 404 error
body: <p>To create the login system i have been using this tutorial - www.codefactorycr.com/login-with-codeigniter-php.html. The problem is when i enter the username and password from my database into the form and click login it comes up with a 404 error page and cannot find verifylogin.php. I have included all my files below but i still cant figure out why this is not logging in to the home.php</p>
  
  <p>Autoload.php</p>
  
  <pre><code>        Prototype:
          $autoload['libraries'] = array('database', 'session', 'xmlrpc');
  
  
          $autoload['libraries'] = array();
  </code></pre>
  
  <p>routes.php</p>
  
  <pre><code>          $route['login'] = "login";
            $route['news/update/(:num)'] = 'news/update/$1';
            $route['news/create'] = 'news/create';
            $route['news/(:any)'] = 'news/view/$1';
            $route['news'] = 'news';
            $route['(:any)'] = 'pages/view/$1';
            $route['default_controller'] = 'pages/view';
  </code></pre>
  
  <p>config.php   </p>
  
  <pre><code>          $config['base_url']   = 'http://shaek.co.uk/codeigniter';
            $config['index_page'] = 'index.php';
  </code></pre>
  
  <p>Controller - login.php</p>
  
  <pre><code>               &lt;?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  
                 class Login extends CI_Controller {
  
                  function __construct()
                  {
                      parent::__construct();
                  }
  
                   function index()
                   {
                      $this-&gt;load-&gt;helper(array('form'));
                      $this-&gt;load-&gt;view('login_view');
                   }
  
                }
  
             ?&gt;
  </code></pre>
  
  <p>Controller - verifylogin.php</p>
  
  <pre><code>         &lt;?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
  
        class VerifyLogin extends CI_Controller {
  
             function __construct()
             {
          parent::__construct();
          $this-&gt;load-&gt;model('user','',TRUE);
                }
  
            function index()
                     {
           //This method will have the credentials validation
               $this-&gt;load-&gt;library('form_validation');
  
              $this-&gt;form_validation-&gt;set_rules('username', 'Username', 'trim|required|xss_clean');
                 $this-&gt;form_validation-&gt;set_rules('password', 'Password',      'trim|required|xss_clean|callback_check_database');
  
           if($this-&gt;form_validation-&gt;run() == FALSE)
                {
         //Field validation failed.  User redirected to login page
            $this-&gt;load-&gt;view('login_view');
            }
               else
               {
                //Go to private area
               redirect('home_view', 'refresh');
              }
  
              }
  
              function check_database($password)
              {
                  //Field validation succeeded.  Validate against database
                    $username = $this-&gt;input-&gt;post('username');
  
                 //query the database
                      $result = $this-&gt;user-&gt;login($username, $password);
  
                  if($result)
           {
                   $sess_array = array();
                  foreach($result as $row)
         {
                 $sess_array = array(
                 'id' =&gt; $row-&gt;id,
                  username' =&gt; $row-&gt;username
       );
                $this-&gt;session-&gt;set_userdata('logged_in', $sess_array);
              }
                return TRUE;
             }
                else
             {
                  $this-&gt;form_validation-&gt;set_message('check_database', 'Invalid username or password');
               return false;
             }
            }
           }
         ?&gt;
  </code></pre>
  
  <p>Controller home.php</p>
  
  <pre><code>            &lt;?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
         session_start(); //we need to call PHP's session object to access it through CI
         class Home extends CI_Controller {
  
                function __construct()
              {
                parent::__construct();
              }
  
                function index()
              {
                if($this-&gt;session-&gt;userdata('logged_in'))
              {
              $session_data = $this-&gt;session-&gt;userdata('logged_in');
              $data['username'] = $session_data['username'];
              $this-&gt;load-&gt;view('home_view', $data);
             }
                 else
                {
                   //If no session, redirect to login page
                     redirect('login', 'refresh');
                 }
               }
  
                   function logout()
               {
                  $this-&gt;session-&gt;unset_userdata('logged_in');
                  session_destroy();
                  redirect('home', 'refresh');
                }
  
             }
  
          ?&gt;
  </code></pre>
  
  <p>Model - users.php</p>
  
  <pre><code>              &lt;?php
                   Class User extends CI_Model
                {
                  function login($username, $password)
                {
                   $this -&gt; db -&gt; select('id, username, password');
                   $this -&gt; db -&gt; from('users1');
                   $this -&gt; db -&gt; where('username', $username);
                   $this -&gt; db -&gt; where('password', MD5($password));
                   $this -&gt; db -&gt; limit(1);
  
                   $query = $this -&gt; db -&gt; get();
  
                   if($query -&gt; num_rows() == 1)
             {
                      return $query-&gt;result();
                    }
               else
                {
                      return false;
              }
          }
       }
     ?&gt;
  </code></pre>
  
  <p>Views - home_view.php</p>
  
  <pre><code>            &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
          &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
        &lt;head&gt;
        &lt;title&gt;Simple Login with CodeIgniter - Private Area&lt;/title&gt;
        &lt;/head&gt;
          &lt;body&gt;
            &lt;h1&gt;Home&lt;/h1&gt;
                 &lt;h2&gt;Welcome &lt;?php echo $username; ?&gt;!&lt;/h2&gt;
                  &lt;a href="home/logout"&gt;Logout&lt;/a&gt;
              &lt;/body&gt;
               &lt;/html&gt;
  </code></pre>
  
  <p>views - login_view.php</p>
  
  <pre><code> &lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt;
  &lt;html xmlns="http://www.w3.org/1999/xhtml"&gt;
    &lt;head&gt;
     &lt;title&gt;Simple Login with CodeIgniter&lt;/title&gt;
     &lt;/head&gt;
     &lt;body&gt;
        &lt;h1&gt;Simple Login with CodeIgniter&lt;/h1&gt;
       &lt;?php echo validation_errors(); ?&gt;
        &lt;?php echo form_open('verifylogin'); ?&gt;
        &lt;label for="username"&gt;Username:&lt;/label&gt;
         &lt;input type="text" size="20" id="username" name="username"/&gt;
         &lt;br/&gt;
       &lt;label for="password"&gt;Password:&lt;/label&gt;
       &lt;input type="password" size="20" id="passowrd" name="password"/&gt;
        &lt;br/&gt;
         &lt;input type="submit" value="Login"/&gt;
              &lt;/form&gt;
           &lt;/body&gt;
           &lt;/html&gt;
  </code></pre>