public function daftar() { $this->recaptcha = new Recaptcha1(); $captcha_answer["recaptcha_challenge_field"] = $this->input->post('recaptcha_challenge_field'); $captcha_answer["recaptcha_response_field"] = $this->input->post('recaptcha_response_field'); /* Untuk captcha 2 $captcha_answer = $this->input->post('g-recaptcha-response'); */ $response = $this->recaptcha->verifyResponse($captcha_answer); $rule = $this->member_model->rules(); $rule[] = array('field' => 'recaptcha_response_field', 'label' => 'Captcha', 'rules' => array('required', array('check_captcha', function ($str) use($response) { if ($response['success']) { return true; } else { return false; } })), 'errors' => array('check_captcha' => 'maaf captcha salah')); $this->form_validation->set_rules('accept_terms_checkbox', '', 'callback_accept_terms'); $this->form_validation->set_rules($rule); // Form validation if ($this->form_validation->run() == FALSE) { //$data['cap_img'] = $this->captchalibrary->make_captcha(); $bank = $this->db->query("SELECT * FROM bank")->result(); $data['bank'] = object_to_array($bank, 'nama_bank'); $country = $this->db->query("SELECT * FROM country")->result(); $data['list_country'] = object_to_array($country, 'name', 'code'); $gp = Geoplugin::locate("199.115.117.242"); // edit bagian ini $data['country'] = in_array($gp->countryCode, $data['list_country']) ? "ID" : $gp->countryCode; $data['kode_referral'] = $this->uri->segment(3); $this->template->load('template/template_auth', 'auth/register', $data); } else { if ($this->member_model->register() === false) { echo "terjadi error di server"; } else { $this->authlibrary->sendRegistrationMail($this->input->post('member[email]'), $this->input->post('member[username]'), $this->input->post('member[password]')); redirect(base_url() . "auth/success"); } } }