Viewing file: user.php (2.74 KB) -rw-r--r-- Select action/file-type: (+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php include_once('ver_controller.php'); class User extends Ver_controller { function change_pwd () { $data['msg_submit'] = ""; if ($this->input->post('btnSubmit')) { $this->load->library('form_validation'); $this->form_validation->set_error_delimiters('<div class="error">','</div>'); $this->form_validation->set_rules('txtOldPwd','รหัสผ่านเดิม','trim|required|xss_clean'); $this->form_validation->set_rules('txtNewPwd','รหัสผ่านใหม่','trim|required|xss_clean|matches[txtNewPwdConf]'); $this->form_validation->set_rules('txtNewPwdConf','ยืนยันรหัสผ่าน ','trim|required|xss_clean'); if ($this->form_validation->run() == TRUE) { $this->db->trans_begin(); //$this->load->model($this->config->item("ums_folder").'m_umuser', 'umus'); $this->load->model($this->ver_path.'m_umuser', 'umus'); $UsLogin = $this->session->userdata('UsLogin'); $UsPassword = $this->input->post('txtOldPwd'); $qu_umus = $this->umus->check_user2($UsLogin, $UsPassword, $this->config->item("secretcode"));
if ($qu_umus) { $this->umus->UsID = $qu_umus["UsID"]; $this->umus->UsName = $qu_umus["UsName"]; $this->umus->UsLogin = $qu_umus["UsLogin"]; $this->umus->UsPassword = md5($this->config->item("secretcode").$this->input->post('txtNewPwd').$this->config->item("secretcode")); $this->umus->UsPsCode = $qu_umus["UsPsCode"]; $this->umus->UsActive = $qu_umus["UsActive"]; $this->umus->UsSessionID = $qu_umus["UsSessionID"]; $this->umus->update(); $data['msg_submit'] = "<div class=\"green\">เปลี่ยนรหัสผ่านเรียบร้อย</div>"; } else { $data['msg_submit'] = "<div class=\"error\">รหัสผ่านไม่ถูกต้อง</div>"; } if ($this->db->trans_status() === FALSE) { $this->db->trans_rollback(); } else { $this->db->trans_commit(); } } else { $data['msg_submit'] = "<div class=\"error\">ไม่สามารถเปลี่ยนรหัสผ่านได้</div>"; } } $this->ver_view = $this->load->view($this->config->item("ver_folder").'v_change_pwd',$data,TRUE); $this->ver_out(); } } ?>
|