[eluser]Brom[/eluser]
Hello
i have a little problem and i hope you can help me.
My callback-function do not work and i dont know why.
Code:
<?php
class Registrieren extends Controller {
function Registrieren()
{
parent::Controller();
}
function index()
{
$data['titel'] = 'Kostenlos Registrieren';
// Formular abgeschickt ?
if(isset($_POST['submit-registrieren'])) {
$this->load->library('validation');
$this->validation->set_error_delimiters('', '<br>');
$rules['username'] = "callback__userCheck";
$rules['password'] = "trim|required|min_length[3]|max_length[20]|xss_clean";
$rules['email'] = "trim|required|valid_email|xss_clean";
$this->validation->set_rules($rules);
$fields['username'] = 'Username';
$fields['password'] = 'Passwort';
$fields['email'] = 'e-Mail';
$this->validation->set_fields($fields);
if ($this->validation->run() == TRUE){
//$this->load->view('registrieren/erfolgreich_view');
//die();
}
function _userCheck($str) {
$query = $this->db->query("SELECT id,username FROM user WHERE username = ".$this->db->escape($str)." LIMIT 1;");
if($query->num_rows() > 0) {
$this->validation->set_message('_userCheck', 'Dieser Username ist schon in der Datenbank');
return FALSE;
}
else {
return TRUE;
}
}
}
$this->load->view('registrieren/index_view', $data);
}
}
Maybe you can help me ?
- Brom
Sorry, my english is not so god, i hope you understand me.