CodeIgniter Forums
404 Page Not Found : The page you requested was not found. - Printable Version

+- CodeIgniter Forums (https://forum.codeigniter.com)
+-- Forum: Archived Discussions (https://forum.codeigniter.com/forum-20.html)
+--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forum-23.html)
+--- Thread: 404 Page Not Found : The page you requested was not found. (/thread-60313.html)



404 Page Not Found : The page you requested was not found. - El Forum - 02-27-2014

[eluser]samus535[/eluser]
Hi everyone,
I'm new to the Code Igniter framework and I have an issue. I'm trying to do a login screen (Based on Login Script but I still have this error.

Quote:404 Page Not Found
The page you requested was not found

Model: user.php
Code:
<?php
class User extends CI_Model
{
public function login($USR_NOM, $USR_MOT_PASSE)
{
  /*$query = $this->db->get_where('USER',array('USR_NOM' => $USR_NOM, 'USR_MOT_PASSE' => $USR_MOT_PASSE));
  return $query->row_array();*/
  
  $this -> db -> select('USR_ID, USR_NOM, USR_MOT_PASSE');
  $this -> db -> from('USER');
  $this -> db -> where('USR_NOM', $USR_NOM);
  $this -> db -> where('USR_MOT_PASSE', $USR_MOT_PASSE);
  $this -> db -> limit(1);
  
  $query = $this -> db -> get();

  if($query -> num_rows() == 1)
  {
   return $query->result();
  }
  else
  {
   return false;
  }  
}
}

View: login_view.php
Code:
<?php echo validation_errors();?>
<?php echo form_open('verifylogin')?>

<label for="USER_NOM">Nom d'utilisateur</label>
&lt;input type="text" id="USER_NOM" name="USER_NOM" /&gt;

<label for="USER_MOT_PASSE">Mot de passe</label>
&lt;input type="password" id="USER_MOT_PASSE" name="USER_MOT_PASSE" /&gt;

&lt;input type="submit" value="Connexion" /&gt;
&lt;/form&gt;

Controller: login.php

Code:
&lt;?php
if (! defined('BASEPATH')) exit('Impossible d accéder directement à la page');

class Login extends CI_Controller
{
  function __construct()
  {
   parent::__construct();
  }
  
  function index()
  {
   $this->load->helper(array('form'));
   $this->load->view('login/login_view');
  }
}

Controller: verifylogin.php
Code:
&lt;?php
if (! defined('BASEPATH')) exit('Impossible d accéder directement à la page');

class VerifyLogin extends CI_Controller
{
  
  function __construct()
  {
   parent::__construct();
   $this->load->model('user','',TRUE);
  }
  
  function index()
  {
   $this->load->library('form_validation');
  
   $this->form_validation->set_rules('USER_NOM','USR_NOM','trim|required|xss_clean');
   $this->form_validation->set_rules('USER_MOT_PASSE','USR_MOT_PASSE','trim|required|xss_clean|callback_check_database');
  
   if($this->form_validation->run() == FALSE)
   {
    $this->load->view('login/login_view');
   }
   else
   {
    redirect('clients','refresh');
   }
  }
  
  function check_database($USR_MOT_PASSE)
  {
   $USR_NOM = $this->input->post('USR_NOM');
  
   $result = $this->user->login($USR_NOM,$USR_MOT_PASSE);
  
   if($result)
   {
    $sess_array = array();
    foreach($result as $row)
    {
     $sess_array = array(
      'USR_ID' => $row->id,
      'USR_NOM' => $row->nom
     );
     $this->session->set_userdata('Connecté',$sess_array);
    }
    return TRUE;
   }
   else
   {
    $this->form_validation->set_message('check_database', 'Nom d utilisateur ou mot de passe incorrect');
    return FALSE;
   }
  }
}

route.php
Code:
$route['default_controller'] = 'login';

config.php
Code:
$config['base_url'] = 'http://localhost/';
$config['index_page'] = 'index.php';

Any help is really appreciated
Thank you very much and have a nice day
--Samus535