Welcome Guest, Not a member yet? Register   Sign In
login Error
#1

[eluser]Unknown[/eluser]
I am beginner in codeIgniter here is my Code LOgin error.

Controller
----------


function Loginform()
{
$this->load->helper(array('form', 'url'));
$this->load->view('login_view');
}


function loginAction()
{
//$rules['username']="trim|required";
//$rules['password']="trim|required|md5";

//$this->validation->set_rules($rules);
$this->load->library('form_validation');
$this->form_validation->set_rules('username', 'User Name', 'trim|required');
$this->form_validation->set_rules('password', 'Password', 'trim|required|md5');

if($this->form_validation->run() == FALSE){
//echo "you really screwed up...<br />";
//echo anchor('blog/Loginform','back');
redirect('blog/Loginform');
} else {
if($this->form_validation->run() == TRUE){
//echo "you really screwed up...<br />";
if($this->books_model->checkUserLogin() == TRUE){
echo "we're good";
}
else
{
echo "Not Login";
}
/*
$this->session->userdata('logged_in') == TRUE;
redirect('manage');
*/
} else {
echo "wrong login!<br />User:<strong> ".$this->input->post('username')."</strong><br />Password: <strong>".$this->input->post('password')."</strong><br />";
echo anchor('blog/Loginform','back');
}
}
}

model
-----
function checkUserLogin ( $user = NULL , $pass = NULL )
{
$query=$this->db->where("username", $user);
$query=$this->db->where("password", $pass);
$query=$this->db->limit(1,0); // I'd drop this line
$query=$this->db->get('users');

if ($query->num_rows() == 1)
return TRUE;
else
return FALSE;
}

viewer
----


&lt;?php echo form_open('blog/loginAction'); ?&gt;
Username: &lt;?php echo form_input('username'); ?&gt;
Password: &lt;?php echo form_password('password'); ?&gt;
&lt;input class="loginsubmit" type="submit" value="Login" /&gt;
&lt;?php echo form_close(); ?&gt;


error is say

A PHP Error was encountered

Severity: Notice

Message: Undefined property: Blog::$books_model

Filename: controllers/blog.php

Line Number: 130

Fatal error: Call to a member function checkUserLogin() on a non-object in C:\xampp\htdocs\CodeIgniter_myholdings\application\controllers\blog.php on line 130

can u help some any guide
#2

[eluser]regal2157[/eluser]
Did you load your model?




Theme © iAndrew 2016 - Forum software by © MyBB