Created
September 19, 2011 13:26
-
-
Save djonatanb/1226486 to your computer and use it in GitHub Desktop.
Callback para funcionamento de plugin de validação de formulário
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function valida_acesso($value) { | |
if (!empty($value)) { | |
return $this->_model->valida_acesso($value); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function valida_acesso($usuario) { | |
$dados = $this->Login_model->findAll( | |
array('where' => array('USUARIO_LOGIN' => $usuario, 'USUARIO_SENHA' => md5($_POST['password']))) | |
); | |
if (empty($dados)) { | |
$this->form_validation->set_message('valida_acesso', 'Usuário e/ou senha incorretos'); | |
return FALSE; | |
} else { | |
return TRUE; | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public function __construct() { | |
parent::__construct(); | |
$this->load->model('Login_model'); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public $validation = array( | |
array( | |
'field' => 'usuario', | |
'label' => 'Validação', | |
'rules' => 'callback_valida_acesso' | |
) | |
); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment