Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function submit(){
- //passing post data dari view
- if ( $this->input->method() == "post" ){
- $this->load->helper(array('form', 'url'));
- $username = $this->input->post('username');
- $password = password_hash($this->input->post('password'), PASSWORD_DEFAULT);
- $nama = $this->input->post('nama');
- $kodejrs = $this->input->post('kodejrs');
- $alamat = $this->input->post('alamat');
- $telp = $this->input->post('telp');
- $kodejrs = $this->input->post('kodejrs');
- $avatar = $this->input->post('avatar');
- $no_pendaftaran = $this->input->post('no_pendaftaran');
- $jk = $this->input->post('jk');
- $tempat_lahir = $this->input->post('tempat_lahir');
- $tanggal_lahir = $this->input->post('tanggal_lahir');
- $provinsi = $this->input->post('provinsi');
- $kota = $this->input->post('kota');
- $agama = $this->input->post('agama');
- $pend = $this->input->post('pend');
- $asekolah = $this->input->post('asekolah');
- $jsekolah = $this->input->post('jsekolah');
- $wilayah = $this->input->post('wilayah');
- //memasukan ke array
- $data = array(
- 'username' => $username,
- 'password' => $password,
- 'nama' => $nama,
- 'kodejrs' => $kodejrs,
- 'alamat' => $alamat,
- 'telp' => $telp,
- 'kodejrs' => $kodejrs,
- 'avatar' => $avatar,
- 'no_pendaftaran' => $no_pendaftaran,
- 'jk' => $jk,
- 'tempat_lahir' => $tempat_lahir,
- 'tanggal_lahir' => $tanggal_lahir,
- 'provinsi' => $provinsi,
- 'kota' => $kota,
- 'agama' => $agama,
- 'pend' => $pend,
- 'asekolah' => $asekolah,
- 'jsekolah' => $jsekolah,
- 'wilayah' => $wilayah,
- 'active' => 2
- );
- //tambahkan akun ke database
- $this->load->model('model_register');
- $id = $this->model_register->add_account($data);
- //enkripsi id
- $encrypted_id = md5($id);
- $this->load->library('email');
- $config = array();
- $config['charset'] = 'utf-8';
- $config['useragent'] = 'Codeigniter';
- $config['protocol']= "smtp";
- $config['mailtype']= "html";
- $config['smtp_host']= "ssl://smtp.gmail.com";//pengaturan smtp
- $config['smtp_port']= "465";
- $config['smtp_timeout']= "400";
- $config['smtp_user']= "xxx@gmail.com"; // isi dengan email kamu
- $config['smtp_pass']= "xxxx"; // isi dengan password kamu
- $config['crlf']="\r\n";
- $config['newline']="\r\n";
- $config['wordwrap'] = TRUE;
- //memanggil library email dan set konfigurasi untuk pengiriman email
- $this->email->initialize($config);
- //konfigurasi pengiriman
- $this->email->from($config['smtp_user']);
- $this->email->to($username);
- $this->email->subject("Verifikasi Akun");
- $this->email->message(
- "terimakasih telah melakuan registrasi, untuk memverifikasi silahkan klik tautan dibawah ini<br><br>".
- site_url("register/verification/$encrypted_id")
- );
- if($this->email->send())
- {
- echo "Berhasil melakukan registrasi, silahkan cek email kamu";
- }else
- {
- echo "Berhasil melakukan registrasi, namu gagal mengirim verifikasi email";
- }
- echo "<br><br><a href='".site_url("login")."'>Kembali ke Menu Login</a>";
- }else
- { redirect('register', 'refresh'); }
- }
- public function verification($key)
- {
- $this->load->helper('url');
- $this->load->model('model_register');
- $this->model_register->changeActiveState($key);
- echo "Selamat kamu telah memverifikasi akun kamu";
- echo "<br><br><a href='".site_url("login")."'>Kembali ke Menu Login</a>";
- }
- ///BLAAAAA
Add Comment
Please, Sign In to add comment