0

i have written an application(login page) using codeigniter 2.02. when i try to load the page, it displays the following message:

Fatal error: Class 'Controller' not found in /var/www/Files_Manager/application/controllers/login.php on line 2

this is the script:

<?php
class Login extends Controller {
//constructor
function login() {
parent::Controller();
$this->load->helper('url');
$this->load->helper('form');
$this->load->library('form_validation');
$this->load->library('session');
}
//index for showing the login form
function index() {
$this->load->view('login_view');
}
//this function will do the login process
function proseslogin() {
$username = $this->input->post('username'); //read the username that filled by the user
$password = $this->input->post('password'); //read the password that filled by the user
$passwordx = md5($password); //this is for change $password into MD5 form
//the query is to matching the username+password user with username+password from database
$q = $this->db->query("SELECT * FROM tb_user WHERE username='$username' AND userpass='$passwordx'");
if ($q->num_rows() == 1) {
// if the query is TRUE, then save the username into session and load the welcome view
$nama = $q->row()->username;
$this->session->set_userdata('username',$nama);
$data['welcome'] = "Welcome $nama";
$this->load->view('welcome_view', $data);
}
else {
// query error
$data['error']='!! Wrong Username or Password !!';
$this->load->view('login_view', $data);
}
}
//to do logout process
function logout() {
$this->session->sess_destroy();
$data['logout'] = 'You have been logged out.';
$this->load->view('login_view', $data);
}
}
?>

anybody help me solve it.

Edited by Ezzaral: Added code tags. Please use them to format any code that you post. Learning to indent wouldn't hurt either.

2
Contributors
1
Reply
2
Views
6 Years
Discussion Span
Last Post by aquilax
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.