[eluser]Unknown[/eluser]
I try to use extjs and codeigniter make a form submit example.But if I type the error username and passwd and then I press the submit button,the firebug occur an error,I do not know how to fix it ,can anynoe help me
this is my code:
Code:
<?php
class Login extends Controller
{
public function __construct()
{
parent::Controller();
$this->load->model('drugdb','use');
$this->sets = parse_ini_file("./extends/global.ini");
$this->local = parse_ini_file($this->sets['rela'].$this->sets['ini'].__CLASS__.$this->sets['type'],true);
}
public function index()
{
$this->load->library('validation');
$this->load->helper('form');
$this->load->helper('cookie');
$data['title'] = $this->local[__FUNCTION__]['title'];
$data['error'] = '';
$data['rootPath'] = $this->local[__CLASS__]['rootPath'];
$username = $this->input->post('username');
$passwd = $this->input->post('passwd');
$rules['username'] = 'callback_username_check';
$this->validation->set_rules($rules);
if ($this->validation->run() == false)
{
$this->load->view($this->sets['viewPath'].'/'.$this->local[__CLASS__]['viewFloder'].'/'.$this->local[__FUNCTION__]['viewName'],$data);
}
else
{
set_cookie('username',$username,0);
set_cookie('logged',true,0);
redirect('drugindex');
}
}
public function username_check($str)
{
$passwd = $this->input->post('passwd');
$count = $this->use->get_count('admin',array('username'=>$str,'passwd'=>md5($passwd)));
if ($count >0)
return true;
else
{
$this->validation->set_message('username_check','<span class="highlight">login error</span>');
return false;
}
}
}
?>
ps
orry about my english