Skip to content

Instantly share code, notes, and snippets.

@jokosusilo
Created February 26, 2019 07:42
Show Gist options
  • Save jokosusilo/423ee4d9dda6941dc508139d03605393 to your computer and use it in GitHub Desktop.
Save jokosusilo/423ee4d9dda6941dc508139d03605393 to your computer and use it in GitHub Desktop.
codeigniter_auth
<?php
public function requestverify()
{
$this->load->library('form_validation');
$this->form_validation->set_error_delimiters('<div class="text-danger" style="text-align: left;">', '</div>');
$this->form_validation->set_rules('username', 'Username', 'required|callback_username_check');
$this->form_validation->set_rules('spacename', 'Space Name', 'required|callback_spacename_check');
$this->form_validation->set_rules('address', 'Address', 'required');
$this->form_validation->set_rules('representative_name', 'Representative Name', 'required');
$this->form_validation->set_rules('active_phone', 'Active Phone', 'required');
if ($this->form_validation->run() == TRUE) {
$this->verify->insertData($this->input->post());
$this->session->set_flashdata('notification', 'Your request has been received. We will proceed soon.');
redirect('site/requestverify');
}
$this->template->render('site/requestverify');
}
public function username_check($str)
{
$user = $this->db->get_where('user', array('username' => $str))->row();
if ($user) {
if ($str == $user->username){
return TRUE;
}else{
$this->form_validation->set_message('username_check', 'Username does not exist!');
return FALSE;
}
}else{
$this->form_validation->set_message('username_check', 'Username does not exist!');
return FALSE;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment