Unable to load the requested class: �form_validation� - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: Unable to load the requested class: �form_validation� (/showthread.php?tid=48155) |
Unable to load the requested class: �form_validation� - El Forum - 01-06-2012 [eluser]Unknown[/eluser] can any one help with this im in a bit over my head. I have followed this to the letter and it just will not work _________________________________________________________________________________________ A PHP Error was encountered Severity: Notice Message: Use of undefined constant �form_validation� - assumed '�form_validation�' Filename: controllers/account.php Line Number: 9 _________________________________________________________________________________________ A PHP Error was encountered Severity: Notice Message: Use of undefined constant �session� - assumed '�session�' Filename: controllers/account.php Line Number: 9 __________________________________________________________________________________________ A PHP Error was encountered An Error Was Encountered Unable to load the requested class: �form_validation� _________________________________________________________________________________________ This is the code for my controller class _________________________________________________________________________________________ <?php class Account extends CI_Controller { function __construct() { parent::__construct(); $this->load->library (array(‘form_validation’, ‘session’)); $this->load->helper(array(‘url’, ‘form’)); $this->load->model(‘account_model’); $this->_salt = “123456789987654321”; } function index () { if ($this->account_model->logged_in() ===TRUE) { $this->dashboard(TRUE); } else { $this->load->view('account/details'); } } function dashboard($condition = FALSE) { if ($condition ===TRUE OR $this->account_model->logged_in() ===TRUE) { $this->load->view('account/dashboard'); } else { $this->load->view('account/details'); } } function login() { $this->form_validation-> set_rules('username', 'Username', 'xss_clean|required|callback_username_check'); $this->form_validation-> set_rules ('password', 'Password', 'xss_clean|required|min_length[4]|max_length[12]| shal|callback_password_check'); $this->_username = $this->input->post('username'); $this->_password = shal($this->_salt . $this->input->post('password')); { if ($this->form_validation->run() ==FALSE) { $this->load->view('account/login'); } else { $this->account_model->login(); $data ['message'] = "You are logged in" . anchor('account/dashboard', 'Dashboard'); $this->load->view('account/success', $data); } } function register() { $this->form_validation-> set_rules('username', 'Username', 'xss_clean|required'); $this->form_validation-> set_rules('email', 'Email Address', 'xss_clean|required|valid_email|callback_email_exists'); $this->form_validation->set_rules('password', 'Password', 'xss_clean|required|min_length[4]|max_length[12]|matches[password_conf] |shal'); $this->form_validation-> set_rules('password_conf', 'Password Confirmation', 'xss_clean|required|matches[password]|shal'); if ($this->form_validation->run() == FALSE) { $this->load->view('account/register'); } else { $data['username'] = $this->input->post('username'); $data['email'] = $this->input->post('email'); $data['password'] = shal($this->_salt . $this->input->post('password')); if ($this->account_model->create($data) ===TRUE) { $data['message'] = "The user account has been successfully created " . anchor ('account/login', 'here') . "."; $this->load->view('account/success', $data) ; } else { $data['$error'] = "There was a problem when creating your account."; $this->load->view('account/error', $data); } } } function logout() { $this->session->sess_destroy(); $this->load->view('account/logout'); } function password_check() { $this->db->where('username', $this->_username); $query = $this->db->get('users'); $result = $query->row_array(); if ($result['password'] == $this->_password); { return TRUE; } if ($query->num_rows() == 0) { $this->form_validation-> set_message('password_check', ' There was an error!'); return FALSE; } } function user_exists($user) { $query = $this->db->get_where('users', array('username' => $user)); if ($query->num_rows() > 0 ) { $this->form_validation-> set_message ('user_exists', 'The %s already registered.'); return FALSE; } $query->free_result(); return TRUE; } function email_exists($email) { $query = $this->db->get_where('users', array('email' => $email)); if ($query->num_rows() > 0) { $this->form_validation-> set_message ('email_exists', 'the %s is already registered.'); return FALSE; } $query->free_result(); return TRUE; } } } ?> |