public function login_process() { // JCryption JCryption::decrypt(); // cek input $this->tnotification->set_rules('username', 'Username', 'trim|required|max_length[30]'); $this->tnotification->set_rules('pass', 'Password', 'trim|required|max_length[30]'); // process if ($this->tnotification->run() !== FALSE) { // params $username = trim($this->input->post('username', true)); $password = trim($this->input->post('pass', true)); // CSRF token $token_nm = $this->security->get_csrf_token_name(); $csrf_token = $this->tsession->userdata("token", true); // captcha $captcha = $this->input->post('captcha', true); $captcha_data = $this->tsession->userdata('data'); $expiration = time() - 7200; // check token if ($this->input->post($token_nm) == $csrf_token) { if ($captcha_data['word'] == $captcha and $captcha_data['ip_address'] == $_SERVER["REMOTE_ADDR"] and $captcha_data['captcha_time'] > $expiration) { // get user detail $result = $this->m_account->get_user_login_auto_role($username, $password, $this->portal_id); var_dump($result); // check if (!empty($result)) { // cek lock status if ($result['lock_st'] == '1') { // output redirect('home/welcome/index/locked'); } // get airlines $airlines = $this->m_account->get_default_airlines(array($result['user_id'])); // set session $this->tsession->set_userdata('session_pk_member', array('user_id' => $result['user_id'], 'role_id' => $result['role_id'], 'default_page' => $result['default_page'], 'airlines_id' => $airlines)); // insert login time $this->m_account->save_user_login($result['user_id'], $_SERVER['REMOTE_ADDR']); $this->tsession->unset_userdata("token"); // redirect redirect($result['default_page']); } } } } // output redirect('home/welcome/index/error'); }
public function login_process() { $this->tsession->set_userdata('session_fa_stakeholder', array('user_id' => 350, 'role_id' => 59)); // set rules /*$this->tnotification->set_rules('username', 'Username', 'trim|required|max_length[30]'); $this->tnotification->set_rules('pass', 'Password', 'trim|required|max_length[30]');*/ JCryption::decrypt(); // process //if ($this->tnotification->run() !== FALSE) { // params $username = trim($this->input->post('username')); $password = trim($this->input->post('pass')); // get user detail // $result = $this->m_account->get_user_login_auto_role($username, $password, $this->portal_id); // // check // if (!empty($result)) { // // cek lock status // if ($result['lock_st'] == '1') { // // output // redirect('login/stakeholderlogin/index/locked'); // } // // set session // $this->tsession->set_userdata('session_fa_stakeholder', array('user_id' => $result['user_id'], 'role_id' => $result['role_id'])); // // insert login time // $this->m_account->save_user_login($result['user_id'], $_SERVER['REMOTE_ADDR']); // // redirect redirect($result['default_page']); // } else { // // output // redirect('login/stakeholderlogin/index/error'); // } /*} else { // default error redirect('login/stakeholderlogin/index/error'); } // output redirect('login/stakeholderlogin');*/ }
<?php require_once 'include/sqAES.php'; require_once 'include/JCryption.php'; $postBefore = print_r($_POST, true); JCryption::decrypt(); header('Content-type: text/plain'); echo "Original POST\n======================\n"; print_r($postBefore); echo "jCryption example form\n======================\n"; print_r($_POST);