public function register() { $this->load->model('Model_user'); $this->customvalidateRegForm(); $this->init_rpmb_session(); $rpmb['regionlist'] = $this->Model_form->get_regions(); $userkey = $this->superKey(); if (!$this->form_validation->run()) { $form_message = ''; $this->load->view('header'); $this->load->view('register', array('rpmb' => $rpmb, 'form_message' => $form_message)); $this->load->view('footer'); } else { $username = $this->input->post('username'); $password = $this->input->post('password'); $firstname = $this->input->post('firstname'); $position = $this->input->post('position'); $designation = $this->input->post('designation'); $contactno = $this->input->post('contactno'); $middlename = $this->input->post('middlename'); $surname = $this->input->post('surname'); $extensionname = $this->input->post('extensionname'); $email = $this->input->post('email'); $regionlist = $this->input->post('regionlist'); $superkey = $this->encrypt->sha1($userkey . $password); $captcha = $this->input->post('g-recaptcha-response'); if (!$captcha) { $form_message = '<div class="kode-alert kode-alert kode-alert-icon kode-alert-click alert6"><i class="fa fa-lock"></i>Please check the captcha form!.<a href="#" class="closed">×</a></div>'; $this->load->view('header'); // $this->load->view('register', array($rpmb, 'form_message' => $form_message)); $this->load->view('footer'); } else { $secretKey = "6LcMzRwTAAAAAMj1ENuYhur5H67mc8dXSfa_cFIy"; $ip = $_SERVER['REMOTE_ADDR']; $response = file_get_contents("https://www.google.com/recaptcha/api/siteverify?secret=" . $secretKey . "&response=" . $captcha . "&remoteip=" . $ip); $responseKeys = json_decode($response, true); if (intval($responseKeys["success"]) !== 1) { echo '<h2></h2>'; } else { echo '<h2></h2>'; } /** * CORRECTED BY: JFSBALDO * DESCRIPTION OF CORRECTION: tinama ang parameter para sa firstname at email, nagkabaliktad kasi * DATE & TIME OF UPDATE: May 6, 2016, 17:02 */ $Model_user = new Model_user($username, $superkey, $firstname, $middlename, $surname, $extensionname, $email, $regionlist, $position, $designation, $contactno); //username,`password`, email, firstname, middlename,surname,extensionname,region_code $regResult = $Model_user->registerUser(); if ($regResult == 1) { /** * CORRECTED BY: JFSBALDO * DESCRIPTION OF CORRECTION: tinama ang username at email, tinanggal din ang password kasi hindi naman kailangan * DATE & TIME OF UPDATE: May 6, 2016, 17:02 */ $registerSendResult = $this->registration_sendmail($email, $username, $firstname, $middlename, $surname, $extensionname, $regionlist); $form_message = '<div class="kode-alert kode-alert kode-alert-icon kode-alert-click alert3"><i class="fa fa-lock"></i> Registration Successful! <a href="#" class="closed">×</a></div>'; $this->load->view('header'); $this->load->view('login', array($rpmb, 'form_message' => $form_message)); $this->load->view('footer'); $this->redirectIndexLogin(); } else { $form_message = '<div class="kode-alert kode-alert kode-alert-icon kode-alert-click alert6"><i class="fa fa-lock"></i>Registration Failed!<a href="#" class="closed">×</a></div>'; $this->load->view('header'); $this->load->view('register', array('form_message' => $form_message)); $this->load->view('footer'); } } } }